设置.Groovy不能被grails-maven-plugin读取



我有一个Grails应用程序,它在MavenRepos中有依赖项,需要进行身份验证。因此,我在settings.groovy中设置了以下属性。

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

在使用Grails进行构建时,这工作得很好。凭证被读取,Nexus查询被认证,依赖项被下载。

由于我的应用程序是使用Maven进行依赖管理的更大项目的一部分,因此我使用grails-maven-plugin将我的应用程序集成到更大的项目中,以便我可以保留我的BuildConfig。Groovy,而更大的项目为构建维护它的pom.xml文件。

当使用调用mvn包时,我看到它是如何触发grails插件的,它启动了我的构建。然而设置。groovy没有被读取,因此我将无法解析所有依赖项。

try to get credentials for: Sonatype Nexus Repository Manager@testnexus.testserver.com
authentication: k='Sonatype Nexus Repository Manager@testnexus.testserver.com' 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/...

BuildConfig中添加凭据时。groovy它工作得很好,但这不是一个解决方案。

如何配置grails-maven-plugin读取设置?或者我可以在哪里声明这些凭证,以便grails-maven-plugin读取它?

您需要创建maven设置,身份验证模型不一样。

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

最新更新