如何从命令行配置maven插件?

如何从命令行配置maven插件?

我正在尝试从命令行配置 JaCoCo maven 插件,而不是使用pom.xml.prepare-agent到目前为止我已经成功地使用命令执行:

mvn -X -Djacoco.destFile=./coverage/jacoco.exec clean org.jacoco:jacoco-maven-plugin:prepare-agent install

与输出:

[DEBUG] Configuring mojo org.jacoco:jacoco-maven-plugin:0.7.6.201602180812:prepare-agent from plugin realm ClassRealm[plugin>org.jacoco:jacoco-maven-plugin:0.7.6.201602180812, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo 'org.jacoco:jacoco-maven-plugin:0.7.6.201602180812:prepare-agent' with basic configurator -->
[DEBUG]   (f) destFile = /src/coverage/jacoco.exec
...

它创建./coverage/jacoco.exec文件,现在我正在尝试运行report阶段,但我无法设置该阶段的属性。我正在运行命令:

mvn -X -Djacoco.dataFile=./coverage/jacoco.exec -Djacoco.outputDirectory=./jacoco_ut org.jacoco:jacoco-maven-plugin:report

或者

mvn -X -DdataFile=./coverage/jacoco.exec -DoutputDirectory=./jacoco_ut org.jacoco:jacoco-maven-plugin:report

雅可可:报告没有user propertyjacoco:准备代理

我有如下输出:

[DEBUG] Configuring mojo 'org.jacoco:jacoco-maven-plugin:0.7.6.201602180812:report' with basic configurator -->
[DEBUG]   (f) dataFile = /src/target/jacoco.exec
[DEBUG]   (f) outputDirectory = /src/target/site/jacoco
[DEBUG]   (f) outputEncoding = UTF-8
[DEBUG]   (f) project = MavenProject: project:3.2.0-SNAPSHOT @ /src/pom.xml
[DEBUG]   (f) skip = false
[DEBUG]   (f) sourceEncoding = UTF-8
[DEBUG] -- end configuration --

与默认值。

相关内容