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.
Maven - Distribution Management xml section is responsible to define: the remote repositories. how to deploy the project's site and documentation.
From the POM reference: Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed.
snapshotRepository. Repository contains the information needed for deploying to the remote repository. Element.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With