Trebla
Trebla

Reputation: 1172

Grails 4 fresh plugin fails to resolve gradle dependencies

Sample project here: https://github.com/Trebla7th/grails4-plugin-test

Looking into upgrading some applications and plugins to grails 4. Starting with a fresh project just to get the feel for it, using an "out of the box" grails plugin fails to compile.

grailsVersion=4.0.1
gorm.version=7.0.2.RELEASE

gradle 5.1.1

Attempting to compile gives

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

Running 'gradle dependencies --stacktrace' gives the following

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)

This project was created using "create-plugin" and then unchanged other than some proxy configuration to get the dependencies to download. Am I doing something wrong?

Upvotes: 0

Views: 503

Answers (2)

Erando
Erando

Reputation: 899

I just had the same issue when I created a grails 4.0.0 plugin. The build.gradle file has a dependency to org.grails:grails-plugin-testing which need to be removed in order to get gradle to build the app successfully. There's an github issue here: https://github.com/grails/grails-core/issues/11293.

Solution:

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

Upvotes: 0

Trebla
Trebla

Reputation: 1172

Had a conflicting gradle version on my PATH, removing that allowed the gradle dependencies to resolve... hopefully nobody else hits this issue.

Upvotes: 1

Related Questions