GithubHelp home page GithubHelp logo

lgrignon / jsweet-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
18.0 5.0 20.0 160 KB

JSweet maven plugin providing build and clean operations of JSweet sources

License: Apache License 2.0

Java 100.00%

jsweet-maven-plugin's Introduction

JSweet maven plugin

Unleash the power of JSweet into your maven project

Table of Contents

  1. Basic Configuration
  2. Run JSweet
  3. Hot transpilation
  4. Advanced configuration

Basic Configuration

Add the JSweet's plugin repositories to your project's pom.xml:

<pluginRepositories>
	<pluginRepository>
		<id>jsweet-plugins-release</id>
		<name>plugins-release</name>
		<url>http://repository.jsweet.org/artifactory/plugins-release-local</url>
	</pluginRepository>
	<pluginRepository>
		<snapshots />
		<id>jsweet-plugins-snapshots</id>
		<name>plugins-snapshot</name>
		<url>http://repository.jsweet.org/artifactory/plugins-snapshot-local</url>
	</pluginRepository>
</pluginRepositories>

Configure your pom's sourceDirectory, as usual:

<build>
	<sourceDirectory>src</sourceDirectory>

Add your JSweet dependencies (candies):

<dependencies>
	<dependency>
		<groupId>org.jsweet.candies</groupId>
		<artifactId>angular</artifactId>
		<version>1.4.1-SNAPSHOT</version>
	</dependency>

Enable the JSweet transpiler plugin for the preferred phase (here, generate-sources):

<plugin>
	<groupId>org.jsweet</groupId>
	<artifactId>jsweet-maven-plugin</artifactId>
	<version>3.0.0</version>
	<configuration>
		<outDir>javascript</outDir>
		<targetVersion>ES6</targetVersion>
	</configuration>
	<executions>
		<execution>
			<id>generate-js</id>
			<phase>generate-sources</phase>
			<goals>
				<goal>jsweet</goal>
			</goals>
		</execution>
	</executions>
</plugin>

The configuration options of the plugin:

Name Type Values Default
targetVersion enum ES3, ES5, ES6 ES3
module enum Any of the ModuleKind enum's values (e.g. none, commonjs, umd, es2015). none
moduleResolution enum The module resolution strategy (classic, node). classic
outDir string JS files output directory target/js
tsOut string Specify where to place generated TypeScript files. target/ts
tsOnly boolean Do not compile the TypeScript output (let an external TypeScript compiler do so). false
tsserver boolean Faster ts2js transpilation using tsserver false
includes string[] Java source files to be included -
excludes string[] Source files to be excluded -
bundle boolean Bundle up all the generated code in a single file, which can be used in the browser. The bundle files are called 'bundle.ts', 'bundle.d.ts', or 'bundle.js' depending on the kind of generated code. NOTE: bundles are not compatible with any module kind other than 'none'. false
sourceMap boolean Generate source map files for the Java files, so that it is possible to debug Java files directly with a debugger that supports source maps (most JavaScript debuggers). true
sourceRoot string Specify the location where debugger should locate Java files instead of source locations. Use this flag if the sources will be located at run-time in a different location than that at design-time. The location specified will be embedded in the sourceMap to direct the debugger where the source files will be located. -
compileSourceRootsOverride string Specify other source location/s instead of default source locations. Use this flag if the sources will be generated/preprocessed at build-time to a non standard location. default compile sources
encoding string Force the Java compiler to use a specific encoding (UTF-8, UTF-16, ...). UTF-8
noRootDirectories boolean Skip the root directories (i.e. packages annotated with @jsweet.lang.Root) so that the generated file hierarchy starts at the root directories rather than including the entire directory structure. false
enableAssertions boolean Java 'assert' statements are transpiled as runtime JavaScript checks. false
verbose boolean Turn on general information logging (INFO LEVEL). false
veryVerbose boolean Turn on all levels of logging. false
jdkHome string Set the JDK home directory to be used to find the Java compiler. If not set, the transpiler will try to use the JAVA_HOME environment variable. Note that the expected JDK version is greater or equals to version 8. ${java.home}
declaration boolean Generate the d.ts files along with the js files, so that other programs can use them to compile. false
dtsOut string Specify where to place generated d.ts files when the declaration option is set (by default, d.ts files are generated in the JavaScript output directory - next to the corresponding js files). outDir
candiesJsOut string Specify where to place extracted JavaScript files from candies. -
ingoreDefinitions boolean Ignore definitions from def.* packages, so that they are not generated in d.ts definition files. If this option is not set, the transpiler generates d.ts definition files in the directory given by the tsout option. false
factoryClassName string Use the given factory to tune the default transpiler behavior. -
header file A file that contains a header to be written at the beginning of each generated file. If left unspecified, JSweet will generate a default header. -
workingDir directory The directory JSweet uses to store temporary files such as extracted candies. JSweet uses '.jsweet' if left unspecified. -
disableSinglePrecisionFloats boolean By default, for a target version >=ES5, JSweet will force Java floats to be mapped to JavaScript numbers that will be constrained with ES5 Math.fround function. If this option is true, then the calls to Math.fround are erased and the generated program will use the JavaScript default precision (double precision). false
extraSystemPath string Allow an extra path to be added to the system path. -
ignoredProblems string[] Array of JSweetProblems which won't be reported or cause failure. -

Run JSweet

Then, just run the maven command line as usual:

$ mvn generate-sources -P client

Hot transpilation

JSweet maven plugin is now able to watch changes in your JSweet files and transpile them on the fly. Try it with

mvn jsweet:watch

Advanced configuration

You can use the plugin with profiles in order to transpile differently several parts of your application. For instance, a node server and a HTML5 client app:

<profiles>
		<profile>
			<id>client</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jsweet</groupId>
						<artifactId>jsweet-maven-plugin</artifactId>
						<version>3.0.0</version>
						<configuration>
							<outFile>client/out.js</outFile>
							<targetVersion>ES6</targetVersion>
							<includes>
								<include>**/*.java</include>
							</includes>
							<excludes>
								<exclude>**/server/**</exclude>
							</excludes>
						</configuration>
						<executions>
							<execution>
								<id>generate-js</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>jsweet</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>server</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jsweet</groupId>
						<artifactId>jsweet-maven-plugin</artifactId>
						<version>3.0.0</version>
						<configuration>
							<outFile>server/full.js</outFile>
							<module>commonjs</module>
							<targetVersion>ES5</targetVersion>
							<includes>
								<include>**/*.java</include>
							</includes>
							<excludes>
								<exclude>**/app/**</exclude>
							</excludes>
						</configuration>
						<executions>
							<execution>
								<id>generate-js</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>jsweet</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
</profiles>

then run the desired profile:

$ mvn generate-sources -P client

Use with code generators / preprocessors

When using some code generators/preprocessors (eg: Project Lombok) the code is not ready for JSweet fully yet (eg: there are custom annotations to handle beforehand).

To let JSweet use a non default source directory, the compileSourceRootsOverride config element can be used, for instance with Lombok:

<build>                          
    <plugins>
        <plugin>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven-plugin</artifactId>
            <version>1.18.12.0</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>delombok</goal>
                    </goals>
                    <configuration>
                        <addOutputDirectory>false</addOutputDirectory>
                        <sourceDirectory>src/main/java</sourceDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.jsweet</groupId>
            <artifactId>jsweet-maven-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <compileSourceRootsOverride>
                    <compileSourceRoot>target/generated-sources/delombok</compileSourceRoot>
                </compileSourceRootsOverride>
                <sourceRoot>target/generated-sources/delombok</sourceRoot>
                <outDir>javascript</outDir>
                <targetVersion>ES5</targetVersion>
            </configuration>
            <executions>
                <execution>
                    <id>generate-js</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>jsweet</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

jsweet-maven-plugin's People

Contributors

kohlschuetter avatar lgrignon avatar mindhivefi avatar mrmx avatar renaudpawlak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jsweet-maven-plugin's Issues

Generated sourceMap contains windows path and unnecessary sourceRoot

The generated sourceMap is next to the JS file and it has a content like the following:

{
  "version":3,
  "file":"AnotherClass.js",
  "lineCount":20,
  "sourceRoot":"..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\src\\main\\java/",
  "mappings":"AAEA,kE;AAAA,O;AAAA,gB;AAAA,iB;AAAA,0B;AAAA,e;AAAA,wB;AAAA,4B;AAAA,qC;AAAA,sB;AAAA,+B;AAAA,oD;AAAA,gD;;AAEA,wE;AACA,mD;AACA,yB;;;AAJA;",
  "sources":["com\\libmarket\\web\\webresources\\js\\AnotherClass.java"],
  "names":[]
}

My problems are the following:

  • For me sourceRoot seems to be unnecessary if I copy the Java files into the target JAR file next to the JS files. I could not find a way to delete it. The best I could do is set a ".", however, I am not sure it is the right solution.
  • The sources do not have to contain a path at all, only the file name. Even worse, that the source path contains Windows path separators if the compilation is done on windows

A sourceMap I would expect would look like the following:

{
  "version":3,
  "file":"AnotherClass.js",
  "lineCount":20,
  "mappings":"AAEA,kE;AAAA,O;AAAA,gB;AAAA,iB;AAAA,0B;AAAA,e;AAAA,wB;AAAA,4B;AAAA,qC;AAAA,sB;AAAA,+B;AAAA,oD;AAAA,gD;;AAEA,wE;AACA,mD;AACA,yB;;;AAJA;",
  "sources":["AnotherClass.java"],
  "names":[]
}

Maven Install Failing for Project

The most recent changes to the 2.2.0-SNAPSHOT build causes projects using the jsweet-maven-plugin to fail during the install phase.

Steps to reproduce:

  1. Create a maven project and add the jsweet-maven-plugin to the pom.

  2. Add dependencies for the jsweet-transpiler, jsweet-core, and a candy (I used bigjs).

  3. Run 'mvn clean install' on the project.

The command will fail with the error:

[ERROR] failed to create transpiler
java.util.NoSuchElementException: No value present
	at java.util.Optional.get(Optional.java:135)
	at org.jsweet.AbstractJSweetMojo.getCandiesJars(AbstractJSweetMojo.java:431)
       at org.jsweet.AbstractJSweetMojo.createJSweetTranspiler(AbstractJSweetMojo.java:204)
        ...

Debugging through the code, it looks like the problem has something to do with the way it looks up dependency jars. The filter lambda is looking for an artifact with the snapshot name (Foo-1.0.0-SNAPSHOT) but is seeing the jar with the timestamp (Foo-1.0.0-20180101.jar) and failing to match.

tsc command not found

Hi I try to use jsweet-maven-plugin version 3.0.0-RC1 to create javascript Classes from my backend API classes. I download node and npm using the frontend-maven-plugin which works fine so far. But when i try to use the transpiler I get the error message that the tsc.cmd is not found. So i guess the tsc is not installed correctly. What can cause this error?

My pom looks like:

<build>
	<plugins>
		<plugin>
			<groupId>com.github.eirslett</groupId>
			<artifactId>frontend-maven-plugin</artifactId>
			<!-- Use the latest released version: https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
			<version>1.9.1</version>
			<executions>
				<execution>
					<!-- optional: you don't really need execution ids, but it looks nice 
						in your build log. -->
					<id>install node and npm</id>
					<goals>
						<goal>install-node-and-npm</goal>
					</goals>
					<!-- optional: default phase is "generate-resources" -->
					<phase>generate-sources</phase>
				</execution>
			</executions>
			<configuration>
				<nodeVersion>v4.6.0</nodeVersion>

				<!-- optional: with node version greater than 4.0.0 will use npm provided 
					by node distribution -->
				<npmVersion>2.15.9</npmVersion>
				
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.jsweet</groupId>
			<artifactId>jsweet-maven-plugin</artifactId>
			<version>3.0.0-RC1</version>
			<configuration>
				<outFile>client/out.js</outFile>
				<targetVersion>ES6</targetVersion>
				<includes>
					<include>**/*.java</include>
				</includes>
				<excludes>
					<exclude>**/server/**</exclude>
				</excludes>
				<extraSystemPath>${project.basedir}/node/</extraSystemPath>
			</configuration>
			<executions>
				<execution>
					<id>generate-js</id>
					<phase>generate-sources</phase>
					<goals>
						<goal>jsweet</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

I get the error message:

Cannot run program "<user_home>.jsweet-node_modules\tsc.cmd" (in directory "D:\tools\eclipse-workspace\jsweet-test\target\ts"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden
If I look into the directory <user_home>.jsweet-node_modules\ i can't see the tsc.cmd.
Is there any way to configure the path to tsc.cmd?

Plugin properties inheritance

It has been reported on the JSweet forum that the plugin properties are not inherited in child poms. This is strange because normally plugin properties are supposed to be inherited (from the Maven doc). It would be worth checking that JSweet configuration is inherited from the parent pom because it could be helpful. Thanks!

Java version issue

As reported in this discussion.

After switching to jswet 2.0.0-rc1u1 I always have this error :

[INFO] Compiling 266 source files to /home/husky/dev/temp/un-lib/api/api-common/target/classes
An exception has occurred in the compiler (1.8.0_112). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalAccessError: tried to access class com.sun.tools.javac.tree.TreeInfo$1 from class com.sun.tools.javac.tree.TreeInfo
	at com.sun.tools.javac.tree.TreeInfo.diagEndPos(TreeInfo.java:604)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:1826)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:1749)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:1742)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2446)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2429)
	at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:211)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1327)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
	at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
	at com.sun.tools.javac.main.Main.compile(Main.java:523)
	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:952)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:158)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

I tested with different JDK version (and type : oracle,openjdk). different maven version and different machines, but itโ€™s still there.

When I remove the jsweet maven plugin it compiles fine.
My guess is the jsweet maven plugin makes something odd with the classloaders.

Configure path to jsweetconfig.json and jsweet_extension

We are changing our maven build to a multi-module build. Assume a directory layout like this:

project
    module1
        pom.xml (with jsweet plugin)
        jsweetconfig.json
        jsweet_extension
    module2

Our old build script changes the working directory to each module and calls maven inside:

cd module1;
maven install;
cd ../module2;
maven install;
[...]

Now we would just run maven install on our root pom. This change means that the working directory is now project instead of project/module1. Because of that, the jsweet plugin does not find the jsweetconfig.json or the jsweet_extension folder.

As a quick fix, I'm going to pull these two up one level, which means I cannot run a cd module1; maven install; all by itself.
The best way to fix it would be to add a parameter to the plugin configuration to specify these two paths with something like ${project.basedir}/jsweetconfig.json.
Any thoughts on this? Can you add these parameters for the next release, please?

Cannot specify a special PATH to run node from

Hi,

thanks for this maven plugin, it's very useful to us.

Sadly, we have a small issue with it in our CI environment. In this environment we don't have node/npm installed, but we use the maven-frontend-plugin to install node/npm upon build.

Is it possible to add an option to add something to the PATH by redefining : org.jsweet.util.ProcessUtil.EXTRA_PATH ?

Because it seems to do exactly what I need : (https://github.com/cincheo/jsweet/blob/40cb6d3597ef57ed318cf36dd212c5497a493dec/candy-generator/src/main/java/org/jsweet/util/ProcessUtil.java#L74)

I can't modify the PATH outside of maven's run so that's not an option for me sadly.

I can provide the pull request if you accept such change.

it doesn't like the word "plugin"

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM /Users/Terrapin/IdeaProjects/help/pom.xml: Unrecognised tag: 'plugin' (position: START_TAG seen ...\n\n ... @36:13) @

Test classes conversion

Hi
Is it possible to covert test classes? I have tried to use but seems like it undersent only **/*.java. If I put something like src/test/java/**/*.java transplanter ignores everything

Thanks
Arseniy Isakov

Source file resolution cause class duplicates

2019-05-14 09:56:40.040 INFO  JSweetTranspiler:798 - parsing: RegularFileObject[/here/pkg/../pkg/Clazz.java],RegularFileObject[/here/pkg/Clazz.java]
2019-05-14 09:56:40.040 ERROR output:48 - duplicate class: pkg.Clazz at /here/pkg/Clazz.java(12)

Each source entry is mentioned both as /here/pkg/../pkg/Clazz.java and /here/pkg/Clazz.java.

unable to handle non-jar artifact types?

Hi,

I'm trying to use jsweet in our project and found it's unable to handle 'pom' type dependency. For example,

    <dependency>
        <groupId>org.eclipse.jetty.aggregate</groupId>
        <artifactId>jetty-all</artifactId>
        <version>9.3.8.v20160314</version>
        <type>pom</type>
    </dependency>

the artifact shall be jetty-all-9.3.8.v20160314.pom, but the resolver is looking for: jetty-all-9.3.8.v20160314.jar and therefore throwing the error:

[ERROR] failed to create transpiler
org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
----------
1) org.eclipse.jetty.aggregate:jetty-all:jar:9.3.8.v20160314

Plugin issue with classloader -

I'm obtaining this issue with a new installation

java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1, mixed mode, sharing)

mvn generate-source

[INFO] --- jsweet-maven-plugin:2.2.0-SNAPSHOT:jsweet (generate-js) @ jsweet-quickstart ---
[INFO] JSweet transpiler version 2.2.0-SNAPSHOT (build date: 2019-01-16 20:44:54)
2019-02-14 07:16:43.043 ERROR JSweetConfig:149 - class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at org.jsweet.JSweetConfig.initClassPath(JSweetConfig.java:86)
at org.jsweet.AbstractJSweetMojo.createJSweetTranspiler(AbstractJSweetMojo.java:254)
at org.jsweet.JSweetMojo.execute(JSweetMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
2019-02-14 07:16:43.043 ERROR JSweetConfig:149 - class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at org.jsweet.JSweetConfig.initClassPath(JSweetConfig.java:86)
at org.jsweet.transpiler.JSweetTranspiler.(JSweetTranspiler.java:144)
at org.jsweet.AbstractJSweetMojo.createJSweetTranspiler(AbstractJSweetMojo.java:320)
at org.jsweet.JSweetMojo.execute(JSweetMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

How to use include exclude option

In my Project (with the Maven Plugin) I want to transpile and ignore some dependencies and some classes because it would be builded at runtime after a webservice was called

I used and parameters and also but at the end the transpilier says always that

Ignored Problem that I used was : INTERNAL_JAVA_ERROR,INTERNAL_TRANSPILER_ERROR,INTERNAL_TSC_ERROR,MAPPED_TSC_ERROR

package de.example.not_core does not exist
import de.example.not_core;
                                                                             ^
2020-08-07 11:07:30.030 ERROR JSweetTranspiler:95 - C:\example\src\main\java\de\example\Example.java:31: error: cannot find symbol

I read the documentation but I'm a little bit confused. I don't understand if is possibile or not partially transpilation.

Maven 3.8.1 requires https repositories

After upgrading to Maven 3.8.1, I get the following error:

[ERROR] Failed to execute goal on project dtos: Could not resolve dependencies for project ... Failed to collect dependencies at org.jsweet:jsweet-transpiler:jar:3.0.0 -> org.jsweet.ext:typescript.java-ts.core:jar:2.0.3: Failed to read artifact descriptor for org.jsweet.ext:typescript.java-ts.core:jar:2.0.3: Could not transfer artifact org.jsweet.ext:typescript.java-ts.core:pom:2.0.3 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [jsweet-central (http://repository.jsweet.org/artifactory/libs-release-local, default, releases+snapshots), jsweet-snapshots (http://repository.jsweet.org/artifactory/libs-snapshot-local, default, releases+snapshots), jsweet-external (http://repository.jsweet.org/artifactory/ext-release-local, default, releases+snapshots)] -> [Help 1]

I removed all reference to http://repository.jsweet.org/artifactory/libs-release-local in my pom.xml but still see the error - so I assume the link to the HTTP repo is within a dependency POM that I don't control.

Here's the announcement on the https requirement:
https://maven.apache.org/docs/3.8.1/release-notes.html

Maven's documentation suggests using a repository with HTTPS. Is there an equivalent for JSweet?

๐Ÿ‘‹

NPE exception trying to build against 2.0.0-rc1

I'm was trying to switch to the latest version of JSweet and the plugin (2.0.0-rc1) to do some testing with the new features and functionality, but am hitting a null pointer exception when doing so. Below is the full stack trace. Let me know if there's anything other info you'd like or things to try. Thanks

failed to create transpiler at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: failed to create transpiler at org.jsweet.AbstractJSweetMojo.createJSweetTranspiler(AbstractJSweetMojo.java:291) at org.jsweet.JSweetMojo.execute(JSweetMojo.java:39) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.NullPointerException at org.jsweet.AbstractJSweetMojo.logInfo(AbstractJSweetMojo.java:133) at org.jsweet.AbstractJSweetMojo.getCandiesJars(AbstractJSweetMojo.java:335) at org.jsweet.AbstractJSweetMojo.createJSweetTranspiler(AbstractJSweetMojo.java:172) ... 23 more

<bundlesDirectory> ignored?

I have not been able to get the to actually copy the bundle to the indicated directory. Perhaps I am missing something in my POM? I also have the Eclipse plugin, and the two have the same output directory "dist", but it does not seem to work there either.

Am I missing something? I literally just started playing around with JSweet today (and I am super excited), so I probably miss something.

Here is my POM for the record. The bundle.js is always located in target/js

BTW is there anyway to rename the bundle?

Thanks, Hannes

<modelVersion>4.0.0</modelVersion>
<groupId>jsweet-test</groupId>
<artifactId>jsweet-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<repositories>

    <repository>
        <id>jsweet-central</id>
        <name>libs-release</name>
        <url>http://repository.jsweet.org/artifactory/libs-release-local</url>
    </repository>

    <repository>
        <snapshots />
        <id>jsweet-snapshots</id>
        <name>libs-snapshot</name>
        <url>http://repository.jsweet.org/artifactory/libs-snapshot-local</url>
    </repository>

</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>jsweet-plugins-release</id>
        <name>plugins-release</name>
        <url>http://repository.jsweet.org/artifactory/plugins-release-local</url>
    </pluginRepository>
    <pluginRepository>
        <snapshots />
        <id>jsweet-plugins-snapshots</id>
        <name>plugins-snapshot</name>
        <url>http://repository.jsweet.org/artifactory/plugins-snapshot-local</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>

    <dependency>
        <groupId>org.jsweet.candies</groupId>
        <artifactId>jsweet-core</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </dependency>

</dependencies>

<build>
    <sourceDirectory>src</sourceDirectory>

    <plugins>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.jsweet</groupId>
            <artifactId>jsweet-maven-plugin</artifactId>
            <version>1.1.1</version>
            <configuration>
                <sourceMap>true</sourceMap>
                <outDir>target/js</outDir>
                <targetVersion>ES3</targetVersion>
                <verbose>true</verbose>
                <bundle>true</bundle>
                <bundlesDirectory>dist</bundlesDirectory>
            </configuration>

            <executions>
                <execution>
                    <id>generate-js</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>jsweet</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>


    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.jsweet</groupId>
                                    <artifactId>jsweet-maven-plugin</artifactId>
                                    <versionRange>[1.1.0-SNAPSHOT,)</versionRange>
                                    <goals>
                                        <goal>jsweet</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
</pluginManagement>

</build>

Plugin will only copy candy bundle to target once

I am encountering a baffling issue. Using the attached pom.xml file, I can build my library just fine, and the target specified by candiesJsOut (here, "target/candies2") will be populated with the bundle.js for the one candy dependency declared, j4ts. Then I run mvn clean generate-sources a second time -- now my target/ts and target/js populate as before, and the candies2 directory gets created... but it's empty. If I change the name of the target, then clean generate-sources, the new directory gets a copy of the bundle, but the next clean/build cycle removes it.

Try it for yourself:

  • mvn generate-sources
  • ls target/candies --> has j4ts files
  • mvn clean generate-sources
  • ls target/candies --> is empty
  • Edit candiesJsOut property in POM to "candies2" or whatever
  • mvn clean generate-sources
  • ls target/candies2 --> has files
  • mvn clean generate-sources
  • ls target/candies --> is empty

Add a "candy" option to prepare candy required files

  • name: candy=true or candyBuild=true or candyMode=true
  • automatically set the generated js and d.ts files in the META-INF directory (in order to simplify candy creation)
  • generate the candy-metadata.json on it's own too if it's missing that would be nice.

pom file parent project

Hi

I have following maven structure

parent-project
       |-jsweet-project

if I do following :

cd parent-project
mvn clean install   

jsweet use parent-project as current directory instead of parent-project\jsweet-project
So all jsweet generated files will be created under parent project. Also "jsweetconfig.json" file is tried to be resolve under paren directory

Partially I have resolve the issue by following configuration

			<plugin>
				<groupId>org.jsweet</groupId>
				<artifactId>jsweet-maven-plugin</artifactId>
				<version>${version.jsweet.transpiler}</version>
				<executions>
					<execution>
						<id>generate-js</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>jsweet</goal>
						</goals>
						<configuration>
							<verbose>true</verbose>
							<outDir>${project.basedir}/src/main/resources/META-INF/resources/webjars/${project.artifactId}/${project.version}</outDir>
							<dtsOut>${project.basedir}/src/main/resources/META-INF/resources/typings/${project.artifactId}/${project.version}</dtsOut>
							<tsOut>${project.basedir}/target</tsOut>
							<workingDir>${project.basedir}</workingDir>
							<declaration>true</declaration>
							<sourceMap>true</sourceMap>
							<targetVersion>ES6</targetVersion>
							<module>es2015</module>
						</configuration>
					</execution>
				</executions>
			</plugin>

But I cannot configure location of "jsweetconfig.json" file

Thanks
Arseniy Isakov

Multiple Maven Modules

Hello,

i would like to create a Java project with multiple Maven modules, which looks something like this:
-- project
---- pom.xml <-- root pom
---- modules
------ pom.xml <-- modules pom
------ module1
-------- pom.xml <-- module1 pom
-------- src
------ module2
-------- pom.xml <-- module2 pom
-------- src

Module1 is a dependency of module2. I had to put the step of jsweet into the modules pom.xml (module1 and module2). When i run mvn clean generate-sources, module1 transpiles, but in module2 i get an error from jsweet, that module1 is unknown.
Am i doing something wrong? How can i tell jsweet that module1 is a local dependency and is already transpiled?

When i put all the src files in one Maven project it transpiles just fine.
When i put the step into modules pom or root pom it doesn't work anymore.

And my second question would be: If i have multiple maven modules, is it in any way possible to tell maven just to compile and transpile module x, y and z and not all modules? The reason is, this project is a SDK with a lot of business logic and not every product needs all the modules. That's why i would like to only bundle the modules needed. For example mvn clean generate-sources -dModules=module-x,module-y,module-z

Thank you in advance,
Daniel

move .dotfiles to target?

When I build jsweet-quickstart that uses the maven plugin I end up with the following dot directories in the root directory of the project:

.jsweet
.generated
.ts

I'd prefer these files lived in target directory so that when mvn clean is called all state is gone (the usual exception for maven of course is that artifacts installed to .m2/repository remain). Do you see any impediment to moving these files to the target directory (and perhaps giving them non-dot names for visibility)? I think this should be the default behaviour.

Option to include candies JS files in bundle

The bundle produced with <bundle>true</bundle> won't work in the browser because none of the candy dependencies are included.

I'm not sure I didn't miss something here, but I found an example in the separate j4ts project that includes manually concatenating files together post-bundling which I took as confirmation that automatic bundling functionality is not present.

ExceptionInInitializerError

The following exception is raised by this plugin:

Execution generate-js of goal org.jsweet:jsweet-maven-plugin:2.3.5:jsweet failed: An API incompatibility was encountered while executing org.jsweet:jsweet-maven-plugin:2.3.5:jsweet: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jsweet:jsweet-maven-plugin:2.3.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/devnewton/.m2/repository/org/jsweet/jsweet-maven-plugin/2.3.5/jsweet-maven-plugin-2.3.5.jar
[ERROR] urls[1] = file:/C:/Users/devnewton/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[2] = file:/C:/Users/devnewton/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[3] = file:/C:/Users/devnewton/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.24/plexus-interpolation-1.24.jar
[ERROR] urls[4] = file:/C:/Users/devnewton/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/C:/Users/devnewton/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/C:/Users/devnewton/.m2/repository/org/apache/maven/maven-builder-support/3.5.3/maven-builder-support-3.5.3.jar
[ERROR] urls[7] = file:/C:/Users/devnewton/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.1.1/maven-resolver-util-1.1.1.jar
[ERROR] urls[8] = file:/C:/Users/devnewton/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
[ERROR] urls[9] = file:/C:/Users/devnewton/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[10] = file:/C:/Users/devnewton/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
[ERROR] urls[11] = file:/C:/Users/devnewton/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[12] = file:/C:/Users/devnewton/.m2/repository/com/google/guava/guava/20.0/guava-20.0.jar
[ERROR] urls[13] = file:/C:/Users/devnewton/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[14] = file:/C:/Users/devnewton/.m2/repository/org/jsweet/jsweet-transpiler/2.3.5/jsweet-transpiler-2.3.5.jar
[ERROR] urls[15] = file:/C:/Users/devnewton/.m2/repository/org/apache/commons/commons-text/1.3/commons-text-1.3.jar
[ERROR] urls[16] = file:/C:/Users/devnewton/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
[ERROR] urls[17] = file:/C:/Users/devnewton/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar
[ERROR] urls[18] = file:/C:/Users/devnewton/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
[ERROR] urls[19] = file:/C:/Users/devnewton/.m2/repository/com/martiansoftware/jsap/2.1/jsap-2.1.jar
[ERROR] urls[20] = file:/C:/Users/devnewton/.m2/repository/com/google/javascript/closure-compiler/v20161201/closure-compiler-v20161201.jar
[ERROR] urls[21] = file:/C:/Users/devnewton/.m2/repository/com/google/javascript/closure-compiler-externs/v20161201/closure-compiler-externs-v20161201.jar
[ERROR] urls[22] = file:/C:/Users/devnewton/.m2/repository/args4j/args4j/2.33/args4j-2.33.jar
[ERROR] urls[23] = file:/C:/Users/devnewton/.m2/repository/com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2.jar
[ERROR] urls[24] = file:/C:/Users/devnewton/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
[ERROR] urls[25] = file:/C:/Users/devnewton/.m2/repository/com/google/jsinterop/jsinterop-annotations/1.0.0/jsinterop-annotations-1.0.0.jar
[ERROR] urls[26] = file:/C:/Users/devnewton/.m2/repository/org/jsweet/ext/typescript.java-ts.core/1.4.0.1/typescript.java-ts.core-1.4.0.1.jar
[ERROR] urls[27] = file:/C:/Users/devnewton/.m2/repository/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.jar
[ERROR] urls[28] = file:/C:/Users/devnewton/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar
[ERROR] urls[29] = file:/C:/Users/devnewton/.m2/repository/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]

'factoryClassPath' Option Does Not Work for Custom Factory

Currently, the 'factoryClassPath' option in configuration only works for classes in jars included as dependencies of the jsweet-maven-plugin. If a custom JSweetFactory is defined within the project we are generating sources for, the generation will fail with a "cannot find or instantiate factory class" error.

Command line to long error on windows machines

I am using a windows box with JSweet 1.2.0-SNAPSHOT and i am getting an exception during compilation of a project with a few hundred files. It seems that the generated tsc command line is too long. Running the same build on a windows machine is just fine.

Differentiate default value and user values

JSweet v2 should support passing parameters to the transpiler defined within jsweetconfig.json. These parameters will be overridden by local parameters, such as command-line parameters and Maven pom.xml parameters.

The problem with the current implementation is that the Maven plugin forces the transpiler's options with the Mojo's parameters. However these parameters can be user-defined or default values as specified in the Mojo (in the annotations). Problem is: default values should not override the values defined in jsweetconfig.json. Only user-defined values should. As a consequence, we need a way to differentiate user-defined values and default values in the Mojo, in order to avoid overriding pre-existing JSweet configuration with default values. From a brief search, I did not find a way to do this with the Maven MOJO API (??).

If this feature does not exist, we need to change our strategy: all default values should be null, and we should force the value of the option only when the value is not null (i.e. user-defined). It is actually better because the Maven plugin will then rely on JSweet transpiler default values, which will probably be more consistent with other launchers.

The same issue needs to be handled by other launchers (the command line launcher is easy because JSAP provides an API to know if the option is user-defined or not).

CompletionFailure error trace

On examples, I get:

com.sun.tools.javac.code.Symbol$CompletionFailure: class file for jsweet.util.StringTypes$StringTypes$currency not found
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for jsweet.util.StringTypes$StringTypes$number not found
(...)

These messages do not appear with the command line launcher. Probably because of a classpath difference in Maven.

Is Java 11 supported?

Hi there,

Is Java 11 supported? If so how?

I got the error below when trying to use jsweet-maven-plugin with Java 11?

2020-11-10 19:57:39.039 ERROR JSweetConfig:149 - class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')

In this issue it's mentioned JSweet does not support Java > 8, but this is not the case anymore according to this JSweet issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.