Reputation: 4256
I have a remote repository using Nexus.
These Repositories asks for login, I would prefer to expose these repositories with login.
This is my settings.xml
<settings>
<servers>
<server>
<id>dev-repo</id>
<username>user</username>
<password>password</password>
</server>
</servers>
</settings>
And the developers are using a pom.xml with:
<distributionManagement>
<repository>
<id>dev-repo</id>
<url>http://ip:port/nexus/content/repositories/dev-repo/</url>
</repository>
</distributionManagement>
With that configuration everything is OK, but I prefer they have to pass the login in the mvn command or the command ask with a prompt the login instead hard code the login in settings.xml
Any ideas?
Thank you in advance.
Upvotes: 11
Views: 13589
Reputation: 8783
It's quite easy: The settings.xml
file allows variables. Replace user
and password
by named variables:
<servers>
<server>
<id>dev-repo</id>
<username>${user}</username>
<password>${password}</password>
</server>
</servers>
And then, provide explicit values when invoking to Maven:
mvn -Duser=... -Dpassword=... install
Upvotes: 19