Override maven release repository durning deploy

10,063

Solution 1

Use

altReleaseDeploymentRepository

It has the same syntaxes than altDeploymentRepository

More in: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

Solution 2

mvn release:perform -Darguments=-DaltDeploymentRepository=myvalue

the trick is: '-Dargument'

Valid resolution is in yorkw comment (for maven-deploy-plugin in version 2.7) When you use higher version of maven-deploy-plugin (e.g. 2.8) then use parameter altReleaseDeploymentRepository.

maven-deploy-plugin doc

Share:
10,063
ekaqu
Author by

ekaqu

Updated on June 03, 2022

Comments

  • ekaqu
    ekaqu about 2 years

    I am working on an open source library and want to have releases sent to an internal artifactory server. I have been using maven's distributionManagement and overriding altDeploymentRepository to point to the internal server (so its never in the pom). This works fine when I do deploy:deploy but when I use the maven release plugin this seems to get ignored.

    mvn clean -DaltDeploymentRepository=central::default::internalhost deploy ## works
    mvn clean -DaltDeploymentRepository=central::default::internalhost release:perform ## fails, doesn't pick up this setting
    

    How can I override the repository via command line when the release plugin runs deploy?

  • old-monk
    old-monk about 5 years
    Although how you would pass username/password in it?
  • MGP
    MGP about 3 years
    @old-monk the format is "some-id:url", the credentials for the server "some-id" are on your ~/.m2/settings.xml file.