1
votes

I'm having an issue where Maven is not passing the settings to the deploy phase when I use the release plugin. I have my settings.xml file in the same folder as my pom.xml. When I run the following command it deploys successfully to the Maven repository.

mvn deploy -s settings.xml

However when I run this command, it fails saying that it doesn't have permissions to deploy to the repository.

mvn release:perform -B -s settings.xml

Here is the error message: [INFO] [INFO] Error deploying artifact: Failed to transfer file: http://mavenrepo/groupId/artifactId/versionId/artifactId-versionId.pom. Return code is: 401

The only thing I can think that is causing the second to fail is that the release plugin doesn't pass the settings down to the deploy phase. How do I get this to work?

I used to have the MAVEN_OPTS environment variable set to specify my settings.xml file, but since this will run on from TeamCity, that is no longer an option.

1

1 Answers

1
votes

I found a bug in the codehaus Jira for this same issue here. It was fixed in maven-release-plugin 2.2.2. As soon as I changed the version number in my pom.xml, it worked fine.