Gradle task groovyDoc failing with NoClassDefFoundError

I was originally using Gradle 1.5 to test my Groovy scripts but also tried this with Gradle 1.9 and experienced the same problem. 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.

You can see the full stacktrace here:

I forgot to mention that I do have the jansi-1.2.1.jar in the lib folder of the Gradle installation.

I was able to get it working with help from an answer to my stack overflow post here:

The solution is to add the following to the build.gradle file:

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

When trying the suggested fix in the previous post, it raises another exception in my case

:groovydoc FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:groovydoc’.


Please show the relevant parts of your build script, in particular the declaration of the Groovy dependency. Output of ‘gradle -v’ and stack trace (’–stacktrace’) would also help.

Hi there, here it is

allprojects {

apply plugin: ‘groovy’

dependencies {

compile (“org.codehaus.groovy:groovy:${groovyVer}”)

testCompile (“cglib:cglib-nodep:${cglibVer}”)

testCompile (“org.objenesis:objenesis:${objenesisVer}”)

testCompile (“org.spockframework:spock-core:${spockVer}”) {

exclude module: ‘groovy-all’




configurations {


dnanexus.extendsFrom runtime



dependencies {

compile “org.codehaus.gpars:gpars:${gparsVer}”

compile “org.slf4j:slf4j-api:${slf4jVer}”

compile “org.slf4j:jcl-over-slf4j:${slf4jVer}”

compile “org.slf4j:jul-to-slf4j:${slf4jVer}”

compile “org.slf4j:log4j-over-slf4j:${slf4jVer}”

compile “ch.qos.logback:logback-classic:${logbackVar}”

compile “ch.qos.logback:logback-core:${logbackVar}”

compile “commons-lang:commons-lang:${commonsLangVer}”

compile “commons-io:commons-io:${commonsIoVer}”

compile “com.beust:jcommander:${jcommanderVer}”

compile “${jsr305Ver}”

oneJarLib files(‘one-jar/one-jar-boot-0.97.jar’)

dnanexus (project(’:dnanexus’)) {

exclude module: ‘nextflow’


jansi ‘org.fusesource.jansi:jansi:1.11’


groovydoc {

def title = “IPDS ${version}”

groovyClasspath = project.configurations.jansi


Your build script declares a ‘groovy’ (rather than a ‘groovy-all’) dependency, which doesn’t include Groovydoc. Therefore, you’ll have to figure out which dependencies are required for Groovydoc, and add them to the ‘jansi’ configuration as well (which I’d rename to ‘groovydoc’). ‘org.codehaus.groovy:groovy-groovydoc’ and ‘org.codehaus.groovy:groovy-ant’ are two candidates.

Yes, it solved the problem.


GPars (and GroovyFX) have just come up against this problem. Our workaround is slightly different to the above but equally ugly. The core question here is why the default Gradle groovydoc task does not include all the necessary dependencies by default.

This is with Gradle 2.0.

‘GroovyCompile’ and ‘Groovydoc’ use whatever Groovy dependencies are put on the ‘compile’ configuration. Easiest solution is to use ‘groovy-all’.

We definitely depend on groovy-all in the compile configuration. I am having to add ‘org.fusesource.jansi:jansi:1.11’ manually, which I shouldn’t have to. This strikes me as a transitive dependency failure somewhere. I guess the could be in the groovy-all POM if it isn’t a Gradle dependency tracking failure. If this is the case, the issue report should really come from the Gradle team I think.

Of course this assumes I am not doing something very silly in the GPars and GroovyFX builds…

I’m seeing the same issue in a build file of mine and groovy-all is in the compile configuration.

Any chance you can provide a minimal self-contained reproducible example? I’ve been using the ‘Groovydoc’ task with a wide range of ‘groovy-all’ versions, and have never had an issue.

git clone ./gradlew groovydoc

I’m not sure what could have changed to cause this to fail after it had been working. Either: 1) Bumping Groovy from 2.3.5 to 2.3.6: 2) Something changing with spock-core:1.0-groovy-2.3-SNAPSHOT which is the only snapshot dependency in build.gradle

I’m stripping things down now to see what happens…

Commenting out the following line makes the error message go away: source = sourceSets.main.groovy +

Don’t know if I’m spamming Russel by commenting under his post. I’m going to start a new one.

I’ve stripped down my project even further and the problem is being caused by Java multi catch statements.

I also noticed the following error message a few lines up in the output:

[ant:groovydoc] line 37:35: expecting IDENT, found ‘|’