2

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?

twbbas
  • 407
  • 3
  • 9
  • 19

2 Answers2

6

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'
}
Yuri
  • 4,254
  • 1
  • 29
  • 46
denise
  • 116
  • 8
  • I ran into a similar issue. Having run Gradle 1.10 since its release, this error just started happening - this fix does take care of it, but it's still odd. – cjstehno Apr 15 '14 at 14:33
0

Sounds like a corrupt Gradle installation that's missing the Jansi Jar. Try to run with --full-stacktrace to learn more about the error.

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
  • Thanks for the quick response, Peter. I checked my Gradle installation and I have the jansi-1.2.1.jar in that directory. My groovyDoc task works if I checkout the last successful commit. I ran the --full-stacktrace flag but it doesn't mean much to me. It's here if you want to look at it: http://pastebin.com/1infzqtY – twbbas Dec 16 '13 at 19:24
  • So it's Groovy(Doc) that attempts to use Jansi but for some reason doesn't see it. I recommend to try with the latest Gradle version. If the problem persists, please file an issue at http://forums.gradle.org. – Peter Niederwieser Dec 16 '13 at 19:34
  • Worth noting that this is on the Gradle forum: http://forums.gradle.org/gradle/topics/gradle_task_groovydoc_failing_with_noclassdeffounderror – Russel Winder Aug 31 '14 at 11:20