Jenkins Build Failure, Cobertura Error Jenkins Build Failure, Cobertura Error jenkins jenkins

Jenkins Build Failure, Cobertura Error


Seems like you are missing the tools jar in your JDK/JRE library you can confirm it by searching for the JAR in the lib folder if it's not present then you can add the following in your pom.xml

<dependency>   <groupId>com.sun</groupId>   <artifactId>tools</artifactId>   <version>1.6.0</version>   <scope>system</scope>   <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath> </dependency>

Where ${env.JAVA_HOME} points to the JAVA you set in environment variables if you are using another JRE apart from the one set then specify the path like so /var/lib/jenkins/tools/hudson.model.JDK/myjava/JDK8/lib/lib

Hope it helps :)


I guess the jdk in question was above 8 which is still not supported by Cobertura: https://github.com/mojohaus/cobertura-maven-plugin/issues/30

[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument (verification) on project generex: Execution verification of goal org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument failed: Plugin org.codehaus.mojo:cobertura-maven-plugin:2.7 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:0 at specified path /usr/local/lib/jvm/openjdk11/../lib/tools.jar

I had to switch to https://www.jacoco.org/jacoco/ instead.