Jam*_*gas 7 grails maven grails-2.0 aether
我正在尝试从使用Ivy迁移到在Grails 2.4项目中使用Aether解析器.
我遇到的问题与外部化凭据有关.与此相关的信息可以在Grails手册中找到:http://grails.org/doc/latest/guide/conf.html#dependencyRepositories
似乎没有一种记录方式可以像使用常春藤一样以外部方式使用Maven.
有了常春藤,我可以把这样的东西放到我的.grails/settings.groovy文件中:
grails.project.ivy.authentication = {
credentials {
realm = "My Repo"
host = "repo.mycustomrepo.com"
username = "user"
password = "password"
}
}
Run Code Online (Sandbox Code Playgroud)
要使用Aether,我不得不将凭证块直接放在我的BuildConfig.groovy喜欢中:
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo("http://repo.mycustomrepo.com") {
//Add authentication details to repository connection
auth([
username: 'user',
password: 'password'
])
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这对我来说确实存在问题,因为在我的组织中我们使用Artifactory配置为使用我们的LDAP凭据.这是一个问题,因为我不想在源代码管理中提交我的凭据.
有没有未记录的解决方案,或者Grails不支持它吗?
使用以下内容定义您的仓库id:
mavenRepo(id:'myrepo', url:"http://localhost:8085/artifactory/libs-release-local/")
Run Code Online (Sandbox Code Playgroud)
然后~/.grails/settings.groovy使用之前指定的方法定义您的凭据id:
grails.project.dependency.authentication = {
credentials {
id = "myrepo"
username = "foo"
password = "bar"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1816 次 |
| 最近记录: |