1

I am using Quickbuild as my CI. When using Maven's release management plugin and running the release:prepare command, I am getting an error committing the tag to my Git repository. This is most likely because of a permissions error.

I've read solutions to use maven options -Dusername=<username> -Dpassword=<password but given that multiple users can see this configuration, I'd prefer to hide or encrypt the credentials.

I haven't found anything online and was wondering if someone has come across this.

Sal Velazquez
  • 189
  • 2
  • 11

1 Answers1

2

Maven has a built in tool for encrypting passwords for use in your settings.xml. One thing you could try is to add the Git repository to the server tag in your settings file.

So, for example, in the settings.xml file you could add:

<server>
    <id>git-repo-location</id> 
    <username>your username</username>
    <password>{EncycptedPassword=}</password>
</server> 

To encrypt your password in Maven, open the command line and use:

mvn --encrypt-password yourPasswordHere

Copy what it returns and paste it into the settings.xml.

  • 1
    I had 2 identical id's with different username and passwords (encrypted). After removing the incorrect one it works. – Sal Velazquez Aug 08 '14 at 18:29
  • ..and thanks. I didn't know the url used in scm could be used by id in the server element. – Sal Velazquez Aug 08 '14 at 18:39
  • Do you have a working example of this? My settings are ignored by the release plugin, what would you put as if your connection is "scm:git:http://myserver:8081/r/myrepo.git"? – Rasmus Franke Feb 02 '15 at 16:29