我有一个grails 2.3.8项目和一个Artifactory服务器。
Artifactory服务器需要身份验证。
BuildConfig.groovy包含:
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"
}
dependencies {
runtime 'com.oracle:ojdbc6:11.2.0.1.0'
build "commons-dbcp:commons-dbcp:1.4"
compile 'org.jadira.usertype:usertype.jodatime:1.9'
compile "net.sf.ehcache:ehcache-core:2.4.6"
}
plugins {
runtime ":hibernate:3.6.10.13"
runtime ":resources:1.2.7"
build ":tomcat:7.0.52.1"
compile ':cache:1.1.5'
compile ":joda-time:1.4"
}
}
当我跑步时:
grails runApp
我明白了:
Starting process on MYPC/IPADDRESS
Loading Grails 2.3.8
|Configuring classpath
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1 (Use --stacktrace to see the full trace)
Error |
Required Grails build dependencies were not found. This is normally due to internet connectivity issues (such as a misconfigured proxy) or missing repositories in grails-app/conf/BuildConfig.groovy. Please verify your configuration to continue.
看起来常春藤日志配置不适用于maven。如何启动日志记录?为什么我的文物没有解决?
答案 0 :(得分:1)
响应有点晚了,但我遇到了这种类型的问题,并将其追溯到一个设置,告诉Artifactory用404而不是401响应,当有人从回购请求他们无法做出的工件时访问。
我的猜测是,Grails在依赖解析期间不会抢先认证,因此在获取404之后,它永远不会尝试使用BuildConfig.groovy中提供的凭据。
尝试关闭该设置,因为它解决了我的问题。
答案 1 :(得分:0)
尝试更改:
grails.project.ivy.authentication = {
repositories {
mavenRepo "http://SERVER:8081/artifactory/remote-repos"
}
credentials {
realm = "Artifactory Realm"
host = "SERVER"
username = "USER"
password = "PASSWORD"
}
}
到
credentials {
realm = "Artifactory Realm"
host = "SERVER"
username = "USER"
password = "PASSWORD"
}
最近从Ivy到Maven的变化并不总是在文档中100%正确反映。您使用的是maven
,因此我认为ivy
设置无法在此处运行。
答案 2 :(得分:0)
在BuildConfig.groovy中尝试以下配置:
grails.project.dependency.resolver = "maven"
grails.project.ivy.authentication = {
repositories {
mavenRepo('http://SERVER:8081/artifactory/remote-repos') {
auth([
realm: "Artifactory Realm",
username: 'user',
password: 'pass'
])
}
}
}
grails.project.dependency.resolution = {
...
repositories {
inherits true
}
...
}
答案 3 :(得分:0)
在Artifactory中检查了"允许匿名访问" Admin / Sercurity / General中的选项
仍然没有回答为什么身份验证不起作用。
我将就身份验证提出一个单独的问题。 What is the correct way to configure grails maven authentication to Artifactory?