Maven、Gradle 和 Ant 的 Jtest 插件允许手动扩展或覆盖自动检测到的编译数据。这些插件的配置参数相互兼容。
编译数据模型包括传递到 <compilation> 和 <compilations> 参数中的数据结构。
<!-- 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> <!-- ... --> |
如需修改所有项目的编译数据,可以使用 -Djtest.dataUpdate 命令行选项代替修改 XML 文件。这样即可手动修改 JSON 中的项目编译数据。
您可以更新:
支持的操作:
示例:
Djtest.dataUpdate=compilations.classpath.append="/tmp/last1.jar","/tmp/last2.jar"
(将路径添加到列表末尾)-Djtest.dataUpdate=compilations.encoding.set="UTF-8"
(指定新的编码)-Djtest.dataUpdate=compilations.bootpath.prepend="/tmp/first.jar";compilations.sourcelevel.set="1.8"
(将路径添加到列表开头并指定新的 sourcelevel)