Cobertura coverage failing

I am running into issues similar to [].

LOGS: Execution default-cli of goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument failed: Plugin org.codehaus.mojo:cobertura-maven-plugin:2.6 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:0 at specified path /usr/local/Cellar/openjdk/15.0.2/libexec/openjdk.jdk/Contents/Home/../lib/tools.jar


When I do java --version, I get: java 11.0.6 2020-01-14 LTS

Upon searching SO, I found that since I am on the JDK 11, the tools.jar has been removed []. When I run the jacoco, the test cases run. But

ISSUE: I want to report the cobertura coverage report only.

Can I get some help?

1 answer

  • answered 2021-03-26 22:02 Abhilasha Gupta

    I would recommend using latest version of the plugin which is 2.7 and has built in fixes for java 11.

    If you cannot use latest plugin for some reason, here are some of the things you can try

    Use 'mvn dependency:tree' to find where that jar is being called and exclude it like so


    Or you can just reference it in your mvn like

       <systemPath>C:\Program Files\Java\jdk1.11.6\lib\tools.jar</systemPath>

    where system path is link to your lib

    Another way is to provide jdk vm as a run arg

    -vm "C:\Program Files\Java\jdk1.11.6\bin"