I'm currently storing my maven credentials in ~/.m2/settings.xml
:
<server>
<id>my_server_id</id>
<username>my_username</username>
<password>my_password</password>
</server>
However, I'm not satisfied with having the password in clear text, since the password is used for other services, so I'd rather prompt the user for the password when doing a mvn deploy
. I'm deploying to a Nexus OSS install via https.
I know that the password can be encrypted, but since the encryption is reversible, this solution is not appropriate for my case.
Is there a way to make Maven prompt for a password when doing an https deploy?
mvn:install copies your packaged Maven module to your local repository (by default, in ~/. m2/repository ), to be accessed by other local Maven builds. mvn:deploy uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.
So, the answer is yes, mvn deploy will execute install and build the project artifacts.
The mvn deploy runs the deploy plugin which deploys an artifact to the remote repository. A project may include the main jar and associated sources and Javadoc jars. The sources jar contains the Java sources, and the Javadoc jar contains the generated Javadoc.
As mentioned this functionality is currently not supported in the plugin. Issue MDEPLOY-51 actually asks for this improvement:
Allow the user to supply a user name password for a remote server when the deploy goal is called. Currently you have to add the repository username and password to the server.xml file. It would be helpful if the user could be prompted for a username and password on the command line. The password should be hidden when it is entered.
I would suggest voting for this improvement, or possibly implement the functionality yourself.
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