7

Grails 2.4 プロジェクトで Ivy の使用から Aether リゾルバーの使用に移行しようとしています。

私が抱えている問題は、資格情報の外部化に関連しています。これに関連する情報は、Grails のマニュアル ( http://grails.org/doc/latest/guide/conf.html#dependencyRepositories ) にあります。

Ivy で可能だった方法で Maven を使用するための資格情報を外部化する文書化された方法はないようです。

Ivy を使用すると、次のようなものを.grails/settings.groovyファイルに配置できます。

grails.project.ivy.authentication = {
    credentials {
        realm = "My Repo"
        host = "repo.mycustomrepo.com"
        username = "user"
        password = "password"
    }
}

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'
      ])
    }
}

残念ながら、これは私にとって本当に問題です。私の組織では、LDAP 資格情報を使用するように構成された Artifactory を使用しているためです。ソース管理で資格情報をコミットしたくないので、これは問題です。

これに対する文書化されていない解決策はありますか、それとも Grails は単にそれをサポートしていませんか?

4

1 に答える 1

10

リポジトリを次のように定義しますid

 mavenRepo(id:'myrepo', url:"http://localhost:8085/artifactory/libs-release-local/") 

次に~/.grails/settings.groovy、以前に指定した を使用して資格情報を定義しidます。

grails.project.dependency.authentication = {
  credentials {
    id = "myrepo"
    username = "foo"
    password = "bar"
  } 
}
于 2014-07-03T10:34:23.240 に答える