无法打包 Grails 3 应用程序 - NoSuchMethodError [英] Cannot package Grails 3 application - NoSuchMethodError
问题描述
我正在尝试打包我的 Grails 3.1.5 应用程序.
I'm trying to package my Grails 3.1.5 application.
运行grails package
(或grails war
)结果如下:
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)
使用 --stacktrace
运行给出:
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)
我的版本是:
| Grails Version: 3.1.5
| Groovy Version: 2.4.6
| JVM Version: 1.8.0_91
我已经删除了 .gradle
缓存文件夹,运行了 grails clean
,但没有成功.
I've removed the .gradle
cache folder, run a grails clean
, but no luck.
编辑:我目前的解决方案是使用gradle来构建war;gradle war
在构建下生成一个可用于部署的 uber-jar.肯定会很好地使用 grails(除非我遗漏了一些东西).
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).
推荐答案
我已经解决了这个问题:
I have worked around this by using:
./gradlew clean assemble
这会在 ./build/libs/
中产生一个 WAR.
This produces a WAR in ./build/libs/
.
这可能是由 Grails 中的错误引起的,如此处.
It's possible this is caused by a bug on in Grails, as discussed here.
这篇关于无法打包 Grails 3 应用程序 - NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!