[GRADLE-3174] Gradle task groovyDoc failing with NoClassDefFoundError Created: 26/Sep/14 Updated: 02/Jun/16 Resolved: 02/Jun/16 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 2.14-rc-4 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Stefan Wolf |
Resolution: | Fixed | Votes: | 2 |
Issue Links: |
|
Description |
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 { The error I'm getting when running this task is: FAILURE: Build failed with an exception.
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: [1]http://pastebin.com/1infzqtY |
Comments |
Comment by Gradle Forums [ 26/Sep/14 ] |
I forgot to mention that I do have the jansi-1.2.1.jar in the lib folder of the Gradle installation. |
Comment by Gradle Forums [ 26/Sep/14 ] |
I was able to get it working with help from an answer to my stack overflow post here: [1]http://stackoverflow.com/questions/20... The solution is to add the following to the build.gradle file: configurations { jansi.extendsFrom(runtime) }groovydoc { |
Comment by Gradle Forums [ 26/Sep/14 ] |
When trying the suggested fix in the previous post, it raises another exception in my case :groovydoc FAILED FAILURE: Build failed with an exception.
|
Comment by Gradle Forums [ 26/Sep/14 ] |
Please show the relevant parts of your build script, in particular the declaration of the Groovy dependency. Output of `gradle |
Comment by Gradle Forums [ 26/Sep/14 ] |
Hi there, here it is allprojects { dependencies { } configurations { oneJarLib dnanexus.extendsFrom runtime jansi.extendsFrom(runtime) }dependencies { compile "org.codehaus.gpars:gpars:${gparsVer}" oneJarLib files('one-jar/one-jar-boot-0.97.jar') dnanexus (project(':dnanexus')) { exclude module: 'nextflow' }jansi 'org.fusesource.jansi:jansi:1.11' groovydoc { |
Comment by Gradle Forums [ 26/Sep/14 ] |
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. |
Comment by Gradle Forums [ 26/Sep/14 ] |
Yes, it solved the problem. Thanks |
Comment by Gradle Forums [ 26/Sep/14 ] |
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. |
Comment by Gradle Forums [ 26/Sep/14 ] |
`GroovyCompile` and `Groovydoc` use whatever Groovy dependencies are put on the `compile` configuration. Easiest solution is to use `groovy-all`. |
Comment by Gradle Forums [ 26/Sep/14 ] |
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... |
Comment by Gradle Forums [ 26/Sep/14 ] |
I'm seeing the same issue in a build file of mine and groovy-all is in the compile configuration. |
Comment by Gradle Forums [ 26/Sep/14 ] |
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. |
Comment by Gradle Forums [ 26/Sep/14 ] |
git clone [1]https://github.com/msgilligan/bitcoin... |
Comment by Gradle Forums [ 26/Sep/14 ] |
I'm not sure what could have changed to cause this to fail after it had been working. Either: |
Comment by Gradle Forums [ 26/Sep/14 ] |
I'm stripping things down now to see what happens... |
Comment by Gradle Forums [ 26/Sep/14 ] |
Commenting out the following line makes the error message go away: |
Comment by Gradle Forums [ 26/Sep/14 ] |
Don't know if I'm spamming Russel by commenting under his post. I'm going to start a new one. |
Comment by Gradle Forums [ 26/Sep/14 ] |
I've stripped down my project even further and the problem is being caused by Java multi catch statements. |
Comment by Gradle Forums [ 26/Sep/14 ] |
I also noticed the following error message a few lines up in the output: [ant:groovydoc] line 37:35: expecting IDENT, found '|' |
Comment by Gradle Forums [ 26/Sep/14 ] |
OK, here's a reduction to two files: `build.gradle` apply plugin: 'java' dependencies { compile 'org.codehaus.groovy:groovy-all:2.3.7' }groovydoc { // Create GroovyDoc for Groovy + Java classes source = sourceSets.main.groovy + sourceSets.main.java }`RPCClient.java`: import java.io.IOException; public void b() throws Exception { catch (EOFException | SocketException e) { e.printStackTrace(); }} |
Comment by Gradle Forums [ 26/Sep/14 ] |
`gradle groovydoc` with Gradle 2.1 produces the error. |