The Jtest Plugins for Maven, Gradle, and Ant allow you to manually extend or override automatically detected compilation data. The configuration parameters of the plugins are compatible.

The compilation data model includes the structure of data passed into the <compilation> and <compilations> parameters.

<!-- configuration section of Jtest build system plugin -->
  
        <!-- single compilation data customization -->
        <compilation>
            <!-- 
                 Compilation id. If not defined default id for used build system will be used.
              -->
            <id>non_default_id</id>
            <!-- List of source directories -->
            <sourcepath>
                <path>src/main/java</path>
                <path>${path_1}</path>
            </sourcepath>
            <!-- List of directories with compiled classes -->
            <binarypath>
                <path>${basedir}/target/classes</path>
            </binarypath>
            <!-- List of classpath jars -->
            <classpath>
                <path>${extra-classpath-element}</path>
            </classpath>
            <!-- List of Java jars -->
            <bootpath>
                <path>${JAVA_HOME}/jre/lib/rt.jar</path>
            </bootpath
            <encoding>UTF-8</encoding>
            <sourcelevel>1.5</sourcelevel>
            <!-- 
                 When set to "true" fully overrides detected compilation
                 data with same id on same project. When set to "false" 
                 only extends it. By default "false". 
              -->
            <override>false</override>
        </compilation>
        
        <!-- 
             Multiple compilation data customizations can be used 
             if project performs multiple compilations.
          -->
        <compilations>
            <compilation>
                <id>different_id</id>
                <!-- ... compilation data -->
            </compilation>
            <compilation>
                <id>another_id</id>
                <!-- ... compilation data -->
            </compilation>
        </compilations>
        
  <!-- ... -->  

If you need to modify compilation data for all projects, you can use the -Djtest.dataUpdate option from command line, instead of modifying the XML file. This allows you to manually modify project compilation data in JSON.

You can update:

  • classpath
  • bootpath
  • sourcepath
  • resourcepath
  • binarypath
  • encoding
  • sourcelevel

Supported actions:

  • prepend - adds the entry(ies) at the beginning of the list (separate multiple paths with a comma)
  • append - adds the entry(ies) at the end of the list (separate multiple paths with a comma)
  • set - overwrites the current data

Examples:

  • -Djtest.dataUpdate=compilations.classpath.append="/tmp/last1.jar","/tmp/last2.jar" (adds the paths to the end of the list)
  • -Djtest.dataUpdate=compilations.encoding.set="UTF-8" (specifies new encoding)
  • -Djtest.dataUpdate=compilations.bootpath.prepend="/tmp/first.jar";compilations.sourcelevel.set="1.8" (adds the path to the beginning of the list and specifies new sourcelevel)


  • No labels