What is the correct way to configure grails maven authentication for Artifactory?

What is the correct way to configure authentication in Artifactory using a Maven converter?

I am currently 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 permission to ivy, dependencies will be downloaded.

Using maven resolver 401 errors are displayed in the Artifactory request log

Relevant Grails Documentation: http://grails.org/doc/latest/guide/conf.html#dependencyRepositories

It may not have been updated for Maven yet.

+6
source share
3 answers

Our store currently uses Grails 2.3.8, and each developer stores the external assembly configuration in our home directory, which 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's how we set up all 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 this does not work, I would suggest looking at the Artifactory permission settings for your virtual repositories and user rights in general.

+4
source

In BuildConfig.groovy use:

 grails.project.repos.default = "AT" grails { project { repos { AT { url = "http://localhost:8081/artifactory/AT/" username = "bob" password = "MyUnguessablePassword" } } } } 

Doco is a bit hidden, see http://grails-plugins.imtqy.com/grails-release/docs/manual/guide/single.html#repositories

Example produced: http://wordpress.transentia.com.au/wordpress/

+3
source

One option is to put the following in ~ / .grails / settings.groovy

 myArtifactory{ username = 'some_user' password = 'some_pass' } 

and the maven repository is configured as

 mavenRepo("http://my-artifactory") { auth([ username: grailsSettings.config.myArtifactory.username, password: grailsSettings.config.myArtifactory.password ]) updatePolicy "always" } 
+2
source

All Articles