Lokesh
Lokesh

Reputation: 7940

Maven release plugin fails to parse password with special character

I am implementing Maven release plugin in my project to automate our release process. But the release-prepare task fails to checkin the code and errors out with this error

authorization failed: Could not authenticate to server: rejected Basic challenge

I tried all steps mentioned in http://mszalbach.blogspot.in/2011/02/maven-release-plugin-and-commit_05.html but none worked.

I am able to run all svn command via commandline successfully.

I am pretty sure that my svn urls are fine because i am able to checkin the code using maven scm plugin in same pom.

Any suggestions on how to go about solving this?

EDIT:

I just realised that release:prepare runs successfully with cached username/passwd. But if i give same user via -Dusername=testUser -Dpassword=passwd then it fails. Credentials are correct. Am i missing something while passing parameters?

EDIT2:

I spotted the issue, my password starts with $ sign and maven is not parsing it properly thats why this issue is coming. How to take care of special characters in password which running maven command?

Upvotes: 5

Views: 7827

Answers (2)

Jay Dee
Jay Dee

Reputation: 2646

I had a similar issue with mvn --encrypt-password command with a password containing $. Escaping came out as the solution:

Instead of mvn --encrypt-password pa$$word I used mvn --encrypt-password pa\$\$word to make it work.

To make sure how your OS deals with special characters type echo pa$$word.

Upvotes: 4

user944849
user944849

Reputation: 14951

First, add a server element to your ${user.home}/.m2/settings.xml file.

<server>
    <id>your.subversion.host</id>
    <username>yourUserName</username>
    <password>yourPassword</password>
</server>
  • If you make the id the subversion host (e.g. subversion.mycompany.com) then this set up will work with both the maven-release-plugin and the maven-scm-plugin.
  • You may encrypt your password following the directions.

Then, add the following to the POM. (Tip: we have this in our corporate parent POM.)

<project>
   ...
    <properties>
      <project.scm.id>your.subversion.host<project.scm.id>
    </properties>
</project>

References: maven-release-plugin FAQ and Maven settings.xml configuration.

Upvotes: 2

Related Questions