2

我有一个 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 package时,我看到它是如何触发 grails 插件的,它启动了我的构建。但是 settings.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 以读取 settings.groovy 或者我在哪里可以将这些凭据声明为 grails-maven-plugin 读取它?

4

1 回答 1

1

需要创建maven设置,认证模型不一样。

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

于 2013-01-17T21:31:30.193 回答