homaxto
homaxto

Reputation: 5709

Gradle cannot find plugin

I have the following in my build.gradle of my Grails 3 project.

dependencies {
...
    compile "org.grails.plugins:spring-security-core:3.0.3"
    // The following line was the true cause of my problem
    compile("org.grails.plugins:spring-security-oauth-google:0.3.1")
...
}

Now when I run Gradle I get this error:

Error Error initializing classpath: Could not find spring-security-core.zip (org.grails.plugins:spring-security-core:3.0.3).
Searched in the following locations:
https://repo.grails.org/grails/core/org/grails/plugins/spring-security-core/3.0.3/spring-security-core-3.0.3.zip (Use --stacktrace to see the full trace)

If I go to the specified path I do see the plugin but just as reported there is no zip file.
What am I doing wrong here?

Upvotes: 1

Views: 1040

Answers (1)

homaxto
homaxto

Reputation: 5709

The root for this problem I found in a little bit different place than expected.
I am working on upgrading a Grails 2.5 project to Grails 3 and I had lead myself on a wrong track. I needed to include spring-security-oauth-google and when it did not work as expected I also included spring-security-core which then derailed me. The cause of this problem is dependencies being loaded from dependencies I have in my own project. In order to avoid loading those dependencies - called transitive dependencies - the following has to be done:

plugins {
    compile "org.grails.plugins:spring-security-core:3.0.3"
    compile("org.grails.plugins:spring-security-oauth-google:0.3.1") {
        exclude group: 'org.grails.plugins', module: 'spring-security-core'
    }
}

This will load the spring-security-core 3.0.3 correctly ignoring the dependency from spring-security-oauth-google.

Upvotes: 2

Related Questions