0

Is it possible to pass the usename password in the parametres of mvn deploy :

I want to do something like :

mvn deploy -username USERNAME -psw PASSWORD

Actually the username password are picked from the server tag on the settings.xml ...

Mohamed Taboubi
  • 6,663
  • 11
  • 55
  • 87
  • 1
    And what is the problem with picking up the things from `settings.xml` (where it belongs)..? – khmarbaise Mar 16 '20 at 15:55
  • I'mm executing a job that doing a deploy from Jenkins, I have no control on the settings.xml ... – Mohamed Taboubi Mar 16 '20 at 16:08
  • The correct way to handle that is to put credentials into the credentials store in Jenkins and let inject the correct things into the `setting.xml` on the Jenkins server..during the build... – khmarbaise Mar 16 '20 at 16:10
  • If the username/password is currently stored in the settings.xml on the servers home directory this is a security issue... – khmarbaise Mar 16 '20 at 16:12
  • YES, that s true ! but they havent configured a placeholder for that !!!! so I cant inject my credentials ... – Mohamed Taboubi Mar 16 '20 at 16:12
  • Than you should change that...and placeholder in the `settings.xml` on the server is wrong...The config-file-provider plugin of Jenkins handles that perfectly. – khmarbaise Mar 16 '20 at 16:14
  • I'm working with curl actually and I pass the username/password - but I prefer using mvn deploy since it transfer all the needed things (pom.xml the correct folder ect) – Mohamed Taboubi Mar 16 '20 at 16:14
  • 1
    Working with curl? Really? sorry to say that it in the harsh way. Simply wrong. You should check how to configure Jenkins correctly and handle it there...Are you using a repository manager to collect the built artifacts from Jenkins? If not than you should start to do so... – khmarbaise Mar 16 '20 at 16:16
  • This is why I dont want to do so ... it is me that doing the things out of their directive ... They offers Templates to use and I wont use them ... I m building my proper Pipeline .... – Mohamed Taboubi Mar 16 '20 at 16:18
  • 1
    The issue seemed to be that the CI solution is wrongly configured which needs to be solved to make things working well.... – khmarbaise Mar 16 '20 at 16:21
  • Ok thanks @khmarbaise .. I dont think any way mvn deploy offer to override the username psw of the settings.xml .. – Mohamed Taboubi Mar 16 '20 at 16:22
  • 1
    If the standard `settings.xml` does not fit your needs and you cannot change it, why not put your own `settings.xml` into your project? Then you can use it by `mvn clean deploy -s my-settings.xml`. – J Fabian Meier Mar 16 '20 at 16:27
  • hmm, good idea .. but there is other resources with encrypted data .. so I can only copy paste teh content from the original settings.xml ... but I will try something yes! – Mohamed Taboubi Mar 16 '20 at 16:34

0 Answers0