Maven Cobertura and the package without running tests on devices twice

I run maven as follows:

mvn clean cobertura:cobertura package 

I notice that my unit tests run twice (which doubles my build time). Is there a way to run cobertura AND generate the package in the same command without running the tests twice?

+6
source share
1 answer

An easy way would be to run two separate commands. In Bash, it's easy to concatenate them on one line:

 mvn clean cobertura:cobertura && mvn package -Dmaven.test.skip=true 

First bit:

 mvn clean cobertura:cobertura 

Cleans, runs tests, and generates a coverage report.

Second bit:

 mvn package -Dmaven.test.skip=true 

Makes packaging, but says that it does not run tests.

&& exists so that if the first command fails, then it will not try to start the second.

+2
source

Source: https://habr.com/ru/post/977052/


All Articles