1
votes

I'm working on a Grails project that will be using several Maven/Java artifacts stored in a private Maven/Nexus repository that requires authentication credentials. However, I don't know how to configure Grails to point to the repository with the necessary username and password.

How do I configure Grails to use this repository?

Here are the snippets of configuration for the repository from my Maven settings.xml.

...
<repository>
  <id>private-releases</id>
  <name>Private Releases</name>
  <releases>
    <enabled>true</enabled>
    <updatePolicy>daily</updatePolicy>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <url>http://mycompany/nexus/content/groups/private-releases</url>
  <layout>default</layout>
</repository>
...
<server>
  <id>private-releases</id>
  <username>username_here</username>
  <password>password_here</password>
</server>
...
1
Are you using Grails' built-in build system (which isn't related to Gradle)? - Peter Niederwieser
Peter - Good question. I'll edit the question. It's using the built-in Grails build system. - jeffmaher

1 Answers

1
votes

Provide a credentials block for the host:

credentials {
    realm = "Private Releases"
    host = "<host>"
    username = "<user>"
    password = "<password>"
}

When the repos is accessed, grails will look for credentials block matching the host. More info found in this mailing list thread.