j2cl:test

Full name:

com.vertispan.j2cl:j2cl-maven-plugin:0.21.0:test

Description:

Discovers any tests referenced by @J2clTestInput, compiles them to JavaScript, and runs them in the configured browser. Presently this defaults to using optimizationLevel=BUNDLE_JAR and webdriver=HTMLUNIT, though these are actually incompatible (HtmlUnit is not compatible with the es6 "class" keyword, and BUNDLE_JAR avoids transpiling to es3, so a project using this goal must change one or the other to get started.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Binds by default to the lifecycle phase: test.

Required Parameters

Name Type Since Description
<bootstrapClasspath> String - (no description)
Default value is: com.vertispan.j2cl:javac-bootstrap-classpath:0.11.0-9336533b6.
Alias is: javacBootstrapClasspathJar.
<bootstrapJsZip> String - (no description)
Default value is: com.vertispan.j2cl:bootstrap:zip:jszip:0.11.0-9336533b6.
<classpathScope> String - The dependency scope to use for the classpath.

The scope should be one of the scopes defined by org.apache.maven.artifact.Artifact. This includes the following:

  • compile - system, provided, compile
  • runtime - compile, runtime
  • compile+runtime - system, provided, compile, runtime
  • runtime+system - system, compile, runtime
  • test - system, provided, compile, runtime, test

Default value is: test.
<gwt3BuildCacheDir> File - Specifies the path to the build cache. This defaults to a directory in target, but for easier reuse and faster builds between projects, it can make sense to set this globally to a shared directory.
Default value is: ${project.build.directory}/gwt3BuildCache.
User property is: gwt3.cache.dir.
<initialScriptFilename> String - (no description)
Default value is: ${project.artifactId}/test.js.
<internalAnnotationsJar> String - (no description)
Default value is: com.vertispan.j2cl:gwt-internal-annotations:0.11.0-9336533b6.
<jreJar> String - (no description)
Default value is: com.vertispan.j2cl:jre:0.11.0-9336533b6.
<jreJsZip> String - (no description)
Default value is: com.vertispan.j2cl:jre:zip:jszip:0.11.0-9336533b6.
<jsinteropAnnotationsJar> String - (no description)
Default value is: com.google.jsinterop:jsinterop-annotations:2.0.0.
<junitAnnotations> String - (no description)
Default value is: com.vertispan.j2cl:junit-annotations:0.11.0-9336533b6.
<localBuildCache> File - (no description)
Default value is: ${project.build.directory}/j2cl-maven-plugin-local-cache.
<testJsZip> String - (no description)
Default value is: com.vertispan.j2cl:closure-test:zip:jszip:0.11.0-9336533b6.
<webappDirectory> String - The output directory for this goal. Note that this is used in conjunction with initialScriptFilename so that more than one goal or even project can share the same webappDirectory, but have their own sub-directory and output file.
Default value is: ${project.build.directory}/${project.build.finalName}-test.

Optional Parameters

Name Type Since Description
<annotationProcessorMode> AnnotationProcessorMode - (no description)
Default value is: AVOID_MAVEN.
<checkAssertions> boolean - Whether or not to leave Java assert checks in the compiled code. In j2cl:test, defaults to true. Has no effect when the compilation level isn't set to ADVANCED_OPTIMIZATIONS, assertions will always remain enabled.
Default value is: true.
<compilationLevel> String - Describes how the output should be built - presently supports five modes, four of which are closure-compiler "compilationLevel" argument options, and an additional special case for J2cl-base applcations. The quoted descriptions here explain how closure-compiler defines them.
  • ADVANCED_OPTIMIZATIONS - "ADVANCED_OPTIMIZATIONS aggressively reduces code size by renaming function names and variables, removing code which is never called, etc." This is typically what is expected for production builds.
  • SIMPLE_OPTIMIZATIONS - "SIMPLE_OPTIMIZATIONS performs transformations to the input JS that do not require any changes to JS that depend on the input JS." Generally not useful in this plugin - slower than BUNDLE, much bigger than ADVANCED_OPTIMIZATIONS
  • WHITESPACE_ONLY - "WHITESPACE_ONLY removes comments and extra whitespace in the input JS." Generally not useful in this plugin - slower than BUNDLE, much bigger than ADVANCED_OPTIMIZATIONS
  • BUNDLE - "Simply orders and concatenates files to the output." The GWT fork of closure also prepends define statements, and provides wiring for sourcemaps.
  • BUNDLE_JAR - Not a "real" closure-compiler option. but instead invokes BUNDLE on each classpath entry and generates a single JS file which will load those bundled files in order. Enables the compiler to cache results for each dependency, rather than re-generate a single large JS file.

Default value is: BUNDLE_JAR.
User property is: compilationLevel.
<defines> Map - Closure flag: "Override the value of a variable annotated @define. The format is &lt;name&gt;[=&lt;val&gt;], where &lt;name&gt; is the name of a @define variable and &lt;val&gt; is a boolean, number, or a single-quoted string that contains no single quotes. If [=&lt;val&gt;] is omitted, the variable is marked true" In this plugin the format is to provided tags for each define key, where the text contents will represent the value. In the context of J2CL and Java, this can be used to define values for system properties.
<dependencyMode> String - Deprecated. Will be removed in 0.21
Default value is: SORT_ONLY.
<dependencyReplacements> List - (no description)
<enableSourcemaps> boolean - True to enable sourcemaps to be built into the project output.
Default value is: false.
<env> String - Closure flag: "Determines the set of builtin externs to load. Options: BROWSER, CUSTOM. Defaults to BROWSER." Presently we default to BROWSER, but are considering changing this to CUSTOM if we include externs files in the generate jsinterop artifacts, so that each set of bindings is self-contained.
Default value is: BROWSER.
<excludes> List - Not presently used, added to match conventions of other maven test plugins.
<externs> Set - Deprecated. Will be removed in 0.21
<includes> List - Not presently used, added to match conventions of other maven test plugins.
Default value is: **/Test*.java,**/*Test.java, **/GwtTest*.java.
<incrementalEnabled> boolean - (no description)
Default value is: false.
User property is: j2cl.incremental.
<languageOut> String - ECMAScript language level of generated JavasScript. Values correspond to the Closure Compiler reference: https://github.com/google/closure-compiler/wiki/Flags-and-Options
Default value is: ECMASCRIPT5.
User property is: languageOut.
<rewritePolyfills> boolean - Closure flag: "Rewrite ES6 library calls to use polyfills provided by the compiler's runtime." Unlike in closure-compiler, defaults to false.
Default value is: false.
<shutdownWaitSeconds> int - (no description)
<skip> boolean - If set to true, tests will not be compiled or run.
Default value is: false.
User property is: maven.test.skip.
<skipTests> boolean - If set to true, tests will not be run, but will still be compiled to JavaScript.
Default value is: false.
User property is: skipTests.
<taskMappings> Map - (no description)
<tests> List - Not presently used, added to match conventions of other maven test plugins.
<translationsFile> TranslationsFileConfig - Closure flag: "Source of translated messages. Currently only supports XTB."
<webdriver> String - Currently can be "htmlunit" or "chrome" to control how to run tests - this will be rewritten as part of 0.21.
Default value is: htmlunit.
<workerThreadCount> String - (no description)

Parameter Details

<annotationProcessorMode>

(no description)
  • Type: com.vertispan.j2cl.mojo.AnnotationProcessorMode
  • Required: No
  • Default: AVOID_MAVEN

<bootstrapClasspath>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:javac-bootstrap-classpath:0.11.0-9336533b6
  • Alias: javacBootstrapClasspathJar

<bootstrapJsZip>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:bootstrap:zip:jszip:0.11.0-9336533b6

<checkAssertions>

Whether or not to leave Java assert checks in the compiled code. In j2cl:test, defaults to true. Has no effect when the compilation level isn't set to ADVANCED_OPTIMIZATIONS, assertions will always remain enabled.
  • Type: boolean
  • Required: No
  • Default: true

<classpathScope>

The dependency scope to use for the classpath.

The scope should be one of the scopes defined by org.apache.maven.artifact.Artifact. This includes the following:

  • compile - system, provided, compile
  • runtime - compile, runtime
  • compile+runtime - system, provided, compile, runtime
  • runtime+system - system, compile, runtime
  • test - system, provided, compile, runtime, test
  • Type: java.lang.String
  • Required: Yes
  • Default: test

<compilationLevel>

Describes how the output should be built - presently supports five modes, four of which are closure-compiler "compilationLevel" argument options, and an additional special case for J2cl-base applcations. The quoted descriptions here explain how closure-compiler defines them.
  • ADVANCED_OPTIMIZATIONS - "ADVANCED_OPTIMIZATIONS aggressively reduces code size by renaming function names and variables, removing code which is never called, etc." This is typically what is expected for production builds.
  • SIMPLE_OPTIMIZATIONS - "SIMPLE_OPTIMIZATIONS performs transformations to the input JS that do not require any changes to JS that depend on the input JS." Generally not useful in this plugin - slower than BUNDLE, much bigger than ADVANCED_OPTIMIZATIONS
  • WHITESPACE_ONLY - "WHITESPACE_ONLY removes comments and extra whitespace in the input JS." Generally not useful in this plugin - slower than BUNDLE, much bigger than ADVANCED_OPTIMIZATIONS
  • BUNDLE - "Simply orders and concatenates files to the output." The GWT fork of closure also prepends define statements, and provides wiring for sourcemaps.
  • BUNDLE_JAR - Not a "real" closure-compiler option. but instead invokes BUNDLE on each classpath entry and generates a single JS file which will load those bundled files in order. Enables the compiler to cache results for each dependency, rather than re-generate a single large JS file.
  • Type: java.lang.String
  • Required: No
  • User Property: compilationLevel
  • Default: BUNDLE_JAR

<defines>

Closure flag: "Override the value of a variable annotated @define. The format is &lt;name&gt;[=&lt;val&gt;], where &lt;name&gt; is the name of a @define variable and &lt;val&gt; is a boolean, number, or a single-quoted string that contains no single quotes. If [=&lt;val&gt;] is omitted, the variable is marked true" In this plugin the format is to provided tags for each define key, where the text contents will represent the value. In the context of J2CL and Java, this can be used to define values for system properties.
  • Type: java.util.Map
  • Required: No

<dependencyMode>

Deprecated. Will be removed in 0.21
(no description)
  • Type: java.lang.String
  • Required: No
  • Default: SORT_ONLY

<dependencyReplacements>

(no description)
  • Type: java.util.List
  • Required: No

<enableSourcemaps>

True to enable sourcemaps to be built into the project output.
  • Type: boolean
  • Required: No
  • Default: false

<env>

Closure flag: "Determines the set of builtin externs to load. Options: BROWSER, CUSTOM. Defaults to BROWSER." Presently we default to BROWSER, but are considering changing this to CUSTOM if we include externs files in the generate jsinterop artifacts, so that each set of bindings is self-contained.
  • Type: java.lang.String
  • Required: No
  • Default: BROWSER

<excludes>

Not presently used, added to match conventions of other maven test plugins.
  • Type: java.util.List
  • Required: No

<externs>

Deprecated. Will be removed in 0.21
(no description)
  • Type: java.util.Set
  • Required: No

<gwt3BuildCacheDir>

Specifies the path to the build cache. This defaults to a directory in target, but for easier reuse and faster builds between projects, it can make sense to set this globally to a shared directory.
  • Type: java.io.File
  • Required: Yes
  • User Property: gwt3.cache.dir
  • Default: ${project.build.directory}/gwt3BuildCache

<includes>

Not presently used, added to match conventions of other maven test plugins.
  • Type: java.util.List
  • Required: No
  • Default: **/Test*.java,**/*Test.java, **/GwtTest*.java

<incrementalEnabled>

(no description)
  • Type: boolean
  • Required: No
  • User Property: j2cl.incremental
  • Default: false

<initialScriptFilename>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: ${project.artifactId}/test.js

<internalAnnotationsJar>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:gwt-internal-annotations:0.11.0-9336533b6

<jreJar>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:jre:0.11.0-9336533b6

<jreJsZip>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:jre:zip:jszip:0.11.0-9336533b6

<jsinteropAnnotationsJar>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.google.jsinterop:jsinterop-annotations:2.0.0

<junitAnnotations>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:junit-annotations:0.11.0-9336533b6

<languageOut>

ECMAScript language level of generated JavasScript. Values correspond to the Closure Compiler reference: https://github.com/google/closure-compiler/wiki/Flags-and-Options
  • Type: java.lang.String
  • Required: No
  • User Property: languageOut
  • Default: ECMASCRIPT5

<localBuildCache>

(no description)
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.directory}/j2cl-maven-plugin-local-cache

<rewritePolyfills>

Closure flag: "Rewrite ES6 library calls to use polyfills provided by the compiler's runtime." Unlike in closure-compiler, defaults to false.
  • Type: boolean
  • Required: No
  • Default: false

<shutdownWaitSeconds>

(no description)
  • Type: int
  • Required: No

<skip>

If set to true, tests will not be compiled or run.
  • Type: boolean
  • Required: No
  • User Property: maven.test.skip
  • Default: false

<skipTests>

If set to true, tests will not be run, but will still be compiled to JavaScript.
  • Type: boolean
  • Required: No
  • User Property: skipTests
  • Default: false

<taskMappings>

(no description)
  • Type: java.util.Map
  • Required: No

<testJsZip>

(no description)
  • Type: java.lang.String
  • Required: Yes
  • Default: com.vertispan.j2cl:closure-test:zip:jszip:0.11.0-9336533b6

<tests>

Not presently used, added to match conventions of other maven test plugins.
  • Type: java.util.List
  • Required: No

<translationsFile>

Closure flag: "Source of translated messages. Currently only supports XTB."
  • Type: com.vertispan.j2cl.mojo.TranslationsFileConfig
  • Required: No

<webappDirectory>

The output directory for this goal. Note that this is used in conjunction with initialScriptFilename so that more than one goal or even project can share the same webappDirectory, but have their own sub-directory and output file.
  • Type: java.lang.String
  • Required: Yes
  • Default: ${project.build.directory}/${project.build.finalName}-test

<webdriver>

Currently can be "htmlunit" or "chrome" to control how to run tests - this will be rewritten as part of 0.21.
  • Type: java.lang.String
  • Required: No
  • Default: htmlunit

<workerThreadCount>

(no description)
  • Type: java.lang.String
  • Required: No