简体   繁体   中英

How can I configure Grails to download dependencies from a password protected Maven/Nexus repository?

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>
...

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM