Category Archives: Version Control [SCM]

Store Subversion credentials in Maven

When you are using Subversion from the command line instead of via a tool like TortoiseSVN, then you do NOT want to provide your username and password everything again when you want to update or commit the code of your Maven project.

To ensure that your SVN never asks for the credentials again, you can set these in your settings.xml via below addition.

The ID needs to be the host of your Subversion repository. So, when your Subversion url is “https://subversion.company.nl/svn/projects/project1″, then the id is “subversion.company.nl”.

  <servers>
    <server>
      <id>subversion.company.nl</id>
      <username>...</username>
      <password>...</password>
    </server>

    ...
  </servers>

An example of an error from the maven-release-plugin when the [proper] SVN credentials are not available.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project internet-portal-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: E170001: Commit failed (details follow):
[ERROR] svn: E170001: Unable to connect to a repository at URL 'https://subversion.company.nl/svn/projects/internet-portal-parent/trunk'
[ERROR] svn: E170001: OPTIONS of 'https://subversion.company.nl/svn/projects/internet-portal-parent/trunk': authorization failed: Could not authenticate to server: rejected Basic challenge (https://subversion.company.nl)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException