我正在尝试从使用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不支持它吗?
我有一个Grails应用程序,在我的resources.groovy文件中配置了Spring bean.我想知道是否可以从文件系统上的外部源导入我的bean配置,但仍然保持它们的Groovy DSL风格.
我知道可以从XML文件导入bean配置,详见本文" 是否可以将外部bean配置xml文件导入resources.groovy? ",但想知道如何使用Groovy执行此操作DSL bean配置.