I want to run JaCoCo from the command line on a Maven project without including JaCoCo configuration into the pom.xml.
How do I configure and invoke JaCoCo from the command line like:
$ mvn test <JaCoCo - config params>
In essence, I am looking to get a coverage report for a Maven project without having to manually edit its pom.xml. Invoking JaCoCo directly on the Maven project (without invoking the mvn
command would work to.
CodePudding user response:
JaCoCo works by instrumenting the virtual machine before tests are run. Normally one configures the Surefire plugin to include some additional args and use a JVM agent, or to rewrite the byte code of the classes to do something equivalent.
I would check this answer: How to configure JaCoCo maven plugin from command line
CodePudding user response:
You can use:
mvn clean org.jacoco:jacoco-maven-plugin:0.8.8:prepare-agent verify org.jacoco:jacoco-maven-plugin:0.8.8:report
to call jacoco generation directly from command line without any change in your pom file.
You can replace verify
by test