Will
Will

Reputation: 2978

settings.groovy not read by grails-maven-plugin

I have a Grails application that has depencencies in MavenRepos that need authentication. Therefore I've set the following property in my settings.groovy.

grails.project.ivy.authentication = {
    credentials {
        realm = "Sonatype Nexus Repository Manager"
        host = "testnexus.testserver.com"
        username = "testuser123"
        password = "password123"
    }
}

When building using Grails, this works fine. The credentials are read, the Nexus query gets authenticated, dependencies are downloaded.

Since my application is part of a larger project that uses Maven for dependency management, I'm using the grails-maven-plugin for integrating my application in the larger project, so that I can keep my BuildConfig.groovy while the larger project maintains its pom.xml file for the build.

When using calling mvn package, I see how it triggers the grails plugin, which starts my build. However the settings.groovy is not read and because of that I won't be able to resolve all dependencies.

try to get credentials for: Sonatype Nexus Repository [email protected]
authentication: k='Sonatype Nexus Repository [email protected]' c='null'
HTTP response status: 401 url=https://testnexus.testserver.com/nexus/content/groups/public/...
CLIENT ERROR: Unauthorized url=https://testnexus.testserver.com/nexus/content/groups/public/...

When adding the credentials in BuildConfig.groovy it works fine, but that would not be a solution.

How can I configure the grails-maven-plugin to read settings.groovy or where can I declare these credentials to that the grails-maven-plugin reads it?

Upvotes: 2

Views: 1309

Answers (1)

rimero
rimero

Reputation: 2383

You need to create maven settings, the authentication model is not the same.

http://maven.apache.org/settings.html

Upvotes: 1

Related Questions