atc atc - 1 year ago 260
Java Question

Cannot package Grails 3 appplication - NoSuchMethodError

I'm trying to package my Grails 3.1.5 application.


grails package
grails war
) results in the following:

FAILURE: Build failed with an exception.

* What went wrong:

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


Total time: 2.205 secs
| Error Command [package] error: Could not execute build using Gradle distribution ''. (Use --stacktrace to see the full trace)

Running with

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(
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(
at org.gradle.util.SingleMessageLogger.whileDisabled(
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$

My versions are:

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

I've removed the
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download