unit-testinggroovygradlegroovydoc

Gradle task groovyDoc failing with NoClassDefFoundError


I'm using Gradle 1.5 to test my Groovy scripts. The groovyDoc task in build.gradle is set up like:

groovydoc {
    docTitle = "Name"
    windowTitle = "Name"
    destinationDir = file('file://path')
}

The error I'm getting when running this task is:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':groovydoc'.
> java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiRenderWriter

This only started happening after I made a minor code change (adding a single If statement) to one of my classes. I reverted to the previous commit and it does not have this problem. I tried deleting my change in the class and recommitting the same file but it is still failing.

Do you have any ideas?


Solution

  • I upgraded to the current version of Gradle (1.10) and continued to get the same error.

    Added the following to my build.gradle and now it's working.

    configurations {
        jansi.extendsFrom(runtime)
    }
    groovydoc {
        def title = "IPDS ${version}"
        groovyClasspath = project.configurations.jansi
    }
    dependencies {
        jansi 'org.fusesource.jansi:jansi:1.11'
    }