为Artifactory配置grails maven验证的正确方法是什么? [英] What is the correct way to configure grails maven authentication to Artifactory?
问题描述
目前我正在使用:
grails.project.ivy.authentication = {
存储库{
mavenRepohttp:// SERVER:8081 / artifactory / remote-repos
$ b凭证{
realm =Artifactory Realm
host =SERVER
username =USER
password =PASSWORD
}
}
grails.project.dependency.resolver =maven//或ivy
grails.project.dependency.resolution = {
//继承Grails的默认依赖关系
inherits(global){
//在此处指定依赖项排除;例如,取消注释以禁用ehcache:
//排除'ehcache'
}
日志warn//常见问题解析器的日志级别,包括'error','warn',' info','debug'或'verbose'
checksums true //是否验证解析
上的校验和legacyResolve false //是否在插件安装时执行二级解析,不建议并且为了向后兼容
repositories {
inherits true //是否从插件继承存储库定义
// mavenLocal()
mavenRepo id:'Artifactory ',url:http:// SERVER:8081 / artifactory / remote-repos
}
如果我将解析器更改为ivy,则会下载依赖关系。
使用maven解析器Artifactory请求日志显示401错误
相关的Grails文档: ht tp://grails.org/doc/latest/guide/conf.html#dependencyRepositories
也许它尚未针对Maven进行更新。
我们的商店目前使用Grails 2.3.8,并且每个开发人员在我们的主目录中都保留一个外部构建配置,其中包含以下内容: artifactory.username ='用户名'
artifactory.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 = {
继承(全球){
}
日志错误
校验和真正
legacyResolve假
repositories {
字符串artifactoryUrl = config.artifactory.repo
mavenRepo(artifactoryUrl){
$ b $ auth([
username:config。 artifactory.username,
password:config.artifactory.password
])
updatePolicyalways
}
mavenLocal()
}
依赖关系{
// ...
}
插件{
// .. 。
}
}
如果这不起作用,我会建议一般会查看您的虚拟存储库和用户权限的Artifactory权限设置。
What is the correct way to configure authentication to Artifactory using the Maven resolver?
Currently I'm using:
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"
}
If I change the resolver to "ivy" dependencies are downloaded.
With maven resolver Artifactory request log shows 401 errors
Relevant Grails documentation: http://grails.org/doc/latest/guide/conf.html#dependencyRepositories
Perhaps it has not yet been updated for Maven.
Our shop is currently using Grails 2.3.8, and each developer keeps a external build config in our home directory that contains the following:
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"
Here is how we configure all of our Grails projects in our BuildConfig.groovy:
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 {
// ...
}
}
If that doesn't work, I would suggest looking at the Artifactory permission settings for your virtual repositories and user permissions in general.
这篇关于为Artifactory配置grails maven验证的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!