Skip to main content

JaCoCo for Java code coverage: Utilities

Under projects/build/plugins, add the following XML:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
And under projects, add this XML:

<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<!-- select non-aggregate reports -->
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

Now all you need to do is run the command mvn test jacoco:report
You can find this report in the target/site/jacoco directory in your project.

Refer Jacoco site https://www.eclemma.org/jacoco/ for more details.

Comments

Popular posts from this blog

Monte Carlo Casino

The Monte Carlo simulation technique has one of the most interesting origin stories in modern science and computing. Its name doesn’t come from a university, a formula, or a scientist — it comes from a  casino . Monte Carlo is a district in Monaco, famous for its casino and games of chance like roulette. The casino became a symbol of randomness, probability, and unpredictability. That symbolism is exactly why the technique carries its name.

The Great Minds

🔬 Science & Philosophy Carl Sagan – astrophysicist, science communicator ( Cosmos ). Richard Dawkins – evolutionary biologist ( The Selfish Gene ). Neil deGrasse Tyson – astrophysicist, communicator ( Astrophysics for People in a Hurry ). Brian Cox – physicist, popular science communicator. 💰 Business, Investing & Strategy Warren Buffett – value investing, Berkshire Hathaway. Charlie Munger – Buffett’s partner, multidisciplinary wisdom. Naval Ravikant – angel investor, modern philosopher ( The Almanack of Naval Ravikant ). Peter Lynch – legendary investor ( One Up on Wall Street ). Steve Jobs – Apple co-founder, master of design and vision. Elon Musk – Tesla, SpaceX, futurist entrepreneur. Richard Dawkins