Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run JaCoCo on a Maven project from the command line?

Tags:

java

maven

jacoco

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.

like image 802
ragnacode Avatar asked Sep 03 '25 03:09

ragnacode


1 Answers

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

like image 189
khmarbaise Avatar answered Sep 05 '25 01:09

khmarbaise