0

此处的示例项目:https ://github.com/Trebla7th/grails4-plugin-test

考虑将一些应用程序和插件升级到 grails 4. 从一个新项目开始只是为了感受它,使用“开箱即用”的 grails 插件无法编译。

grailsVersion=4.0.1
gorm.version=7.0.2.RELEASE

毕业 5.1.1

尝试编译给出

Error |
Could not resolve all dependencies for configuration ':testRuntime'. Type 'gradle dependencies' for more information

运行 'gradle dependencies --stacktrace' 给出以下信息

Configuring signAndPublish task for project :
Applying dependency management to configuration 'assets' in project 'grails4-plugin-test'
Applying dependency management to configuration 'gspCompile' in project 'grails4-plugin-test'
Applying dependency management to configuration 'developmentOnly' in project 'grails4-plugin-test'
Resolving global dependency management for project 'grails4-plugin-test'

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'grails4-plugin-test'.
> Failed to notify project evaluation listener.
   > org.codehaus.groovy.runtime.DefaultGroovyMethods.each([Ljava/lang/Object;Lgroovy/lang/Closure;)[Ljava/lang/Object;

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'grails4-plugin-test'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:79)
...snip...
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
...snip... 
Caused by: java.lang.NoSuchMethodError: 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each([Ljava/lang/Object;Lgroovy/lang/Closure;)[Ljava/lang/Object;
    at org.grails.gradle.plugin.core.GrailsGradlePlugin.buildClasspath(GrailsGradlePlugin.groovy:608)

这个项目是使用“create-plugin”创建的,然后除了一些代理配置之外没有任何变化,以获取要下载的依赖项。难道我做错了什么?

4

2 回答 2

1

在我的 PATH 上有一个冲突的 gradle 版本,删除它可以解决 gradle 依赖项......希望没有其他人遇到这个问题。

于 2020-01-16T16:00:49.870 回答
0

我在创建 grails 4.0.0 插件时遇到了同样的问题。该build.gradle文件有一个依赖org.grails:grails-plugin-testing项,需要删除该依赖项才能让 gradle 成功构建应用程序。这里有一个 github 问题:https ://github.com/grails/grails-core/issues/11293 。

解决方案:

// testCompile "org.grails:grails-plugin-testing"

于 2020-09-23T09:00:18.320 回答