atc atc - 5 months ago 70
Java Question

Cannot package Grails 3 appplication - NoSuchMethodError

I'm trying to package my Grails 3.1.5 application.

Running

grails package
(or
grails war
) results in the following:

FAILURE: Build failed with an exception.

* What went wrong:
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/List;Lgroovy/lang/Closure;)Ljava/util/List;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.205 secs
| Error Command [package] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.6-bin.zip'. (Use --stacktrace to see the full trace)


Running with
--stacktrace
gives:

Caused by: java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/List;Lgroovy/lang/Closure;)Ljava/util/List;
at asset.pipeline.gradle.AssetCompile.getSource(AssetCompile.groovy:188)
at asset.pipeline.gradle.AssetCompile_Decorated.getSource(Unknown Source)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:460)
at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:166)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:458)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$1.call(AnnotationProcessingTaskFactory.java:262)


My versions are:

| Grails Version: 3.1.5
| Groovy Version: 2.4.6
| JVM Version: 1.8.0_91


I've removed the
.gradle
cache folder, run a
grails clean
, but no luck.

Any ideas please?

Edit: My current solution is to use gradle to build the war;
gradle war
produces an uber-jar under build that I can use for deployments. Would sure by nice to use grails for this (unless I'm missing something).

atc atc
Answer

I have worked around this by using:

./gradlew clean assemble

This produces a WAR in ./build/libs/.

It's possible this is caused by a bug on in Grails, as discussed here.

Comments