Closed lbkvarshney closed 3 years ago
@lbkvarshney - I am guessing when you are passing it from the command your pom has those properties. For example when you run mvn install -Ptest -Dusername=username -Dpassword=password
, your pom has
<apigee.username>${username}</apigee.username>
<apigee.password>${password}</apigee.password>
If you had that - it could be possible due to some special characters in your password that is breaking it. Try passing the password in your maven command within single quotes
Also try with a -X
to your maven command to run it in debug mode, you can find the actual values of the username and password passed.
Thanks @ssvaidyanathan for the response.It works if we supply username and password both in mvn command and POM as suggested. However it doesn't work if we supply username and password in mvn command ONLY BUT NOT in pom. Can we have this feature where a user can supply username and password in mvn command ONLY but NOT in pom?so that username and password can be extracted from Jenkins Vault just before running mvn command and we need not pass them in pom as plain text.
@lbkvarshney - The above sample is what that does. You just need to have
<apigee.username>${username}</apigee.username>
<apigee.password>${password}</apigee.password>
in your pom and then in your Maven call, just pass the params as arguments something like this
mvn clean install -Ptest -Dusername=foo@example.com -Dpassword=superSecret
Check this sample, where I have a Jenkinsfile that uses the Jenkins Creds Manager to fetch the user credentials and then pass to the mvn command.
Thanks @ssvaidyanathan for the response. Is it possible to configure the plugin in such a way that we can pass the creds(username and password) in mvn command ONLY for deployment and we DO NOT NEED to have them in pom as pom has password in plain text and we use shared slaves therefore there is a possibility that password can be compromised.
As I said, you dont need to have the password in the pom file. You just need the properties in your pom profile which has the variable name you pass from the maven command. See my comment above, the pom will just have <apigee.password>${password}</apigee.password>
and you pass the actual password as an argument -Dpassword=something
Closing this issue as there are no activities. Please re-open if needed
mvn install -Ptest -Dusername=username -Dpassword=password results in 401 Unauthorized however when we pass username and password options in shared-pom file(as shown below) it works.