gpt4 book ai didi

maven - 将 grails maven 身份验证配置为 Artifactory 的正确方法是什么?

转载 作者:行者123 更新时间:2023-12-04 14:12:57 27 4
gpt4 key购买 nike

使用 Maven 解析器配置对 Artifactory 的身份验证的正确方法是什么?

目前我正在使用:

grails.project.ivy.authentication = {
repositories {
mavenRepo "http://SERVER:8081/artifactory/remote-repos"

}
credentials {
realm = "Artifactory Realm"
host = "SERVER"
username = "USER"
password = "PASSWORD"
}
}

grails.project.dependency.resolver = "maven" // or ivy

grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

repositories {
inherits true // Whether to inherit repository definitions from plugins

// mavenLocal()

mavenRepo id: 'Artifactory', url: "http://SERVER:8081/artifactory/remote-repos"

}

如果我将解析器更改为“ivy”,则会下载依赖项。

使用 maven 解析器 Artifactory 请求日志显示 401 错误

相关 Grails 文档: http://grails.org/doc/latest/guide/conf.html#dependencyRepositories

也许它还没有为 Maven 更新。

最佳答案

我们的商店目前使用 Grails 2.3.8,每个开发人员在我们的主目录中保存一个外部构建配置,其中包含以下内容:

artifactory.username = 'username'
artifactory.password = 'password'
artifactory.repo = 'http://our.artifactory.server.com:8080/artifactory/central'
artifactory.repositoryLocation = "http://our.artifactory.server.com:8080/artifactory/libs-release-local"

以下是我们在 BuildConfig.groovy 中配置所有 Grails 项目的方法:
def config = new ConfigSlurper(grailsSettings.grailsEnv).parse(new File("$home/my_build_config.groovy").toURI().toURL())

grails.project.dependency.resolver = "maven"

grails.project.dependency.resolution = {

inherits("global") {
}

log "error"
checksums true
legacyResolve false

repositories {

String artifactoryUrl = config.artifactory.repo
mavenRepo(artifactoryUrl) {

auth([
username: config.artifactory.username,
password: config.artifactory.password
])

updatePolicy "always"
}
mavenLocal()
}

dependencies {

// ...
}

plugins {

// ...
}
}

如果这不起作用,我建议您查看虚拟存储库的 Artifactory 权限设置和一般用户权限。

关于maven - 将 grails maven 身份验证配置为 Artifactory 的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23669806/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com