Search code examples
eclipsegradlejacocorandoop

How to use jacoco manually in eclipse gradle project


I want to use the API of jacoco in my codes in an eclipse gradle project. But the jacoco library seems not on the build path of my project. The jacoco is a plugin of gradle. I can not use jacoco library directly in eclipse gradle project.

Here is an screen shot: when import jacoco library such as 'import org.jacoco....', the system went wrong. eclipse screen shot

The project is randoop, I can build it using gradle in command line successfully. But I can not develop it in eclipse, can anyone help?


Solution

  • Take a look at the FAQ for the Gradle-Eclipse tool. It specifically notes which dependencies are included, and how to add additional ones.

    The JaCoCo compile dependency in the Randoop build file is the custom dependency systemTestCompile, so, based on the FAQ you'll have to add it using

    eclipse.classpath.plusConfigurations << systemTestCompile
    

    after the configurations block in the build script.

    (If you do modify the Randoop build script in a way that helps with the Eclipse configuration, please do a Pull Request. We'll be happy to add it.)