Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between altDeploymentRepository and altReleaseDeploymentRepository

I use swagger to generate web services clients on my project. The generated code produce a library that can be use as a Maven lib. I already successfully deploy release version into my private sonatype-nexus.

I wonder what is the difference between altDeploymentRepository and altReleaseDeploymentRepository? How mvn deploy select which repository to use if the two parameters are set?

As the apache-maven deploy documentation said :

altDeploymentRepository: Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in ). Format: id::layout::url

altReleaseDeploymentRepository: The alternative repository to use when the project has a final version.

altSnapshotDeploymentRepository: The alternative repository to use when the project has a snapshot version.

What exactly does

when the project has a final version.

mean?

like image 487
Lionel Briand Avatar asked Jan 12 '17 11:01

Lionel Briand


People also ask

What is distributionManagement in POM XML?

From the POM reference: Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed.

What is the purpose of the deploy plugin for Apache Maven?

The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.

Does Maven deploy include install?

So, the answer is yes, mvn deploy will execute install and build the project artifacts.

How does Maven deploy work?

The deploy is the last phase of the maven lifecycle. In this phase, the build is completed and the current project is being copied to the remote repository. This makes the built project available for other projects to add as dependency or developers.

What is altdeploymentrepository?

Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). Note: Since 3.0.0 the layout part has been removed. User property is: altDeploymentRepository. The alternative repository to use when the project has a final version.

What is altreleasedeploymentrepository in Apache Maven?

As the apache-maven deploy documentationsaid : altDeploymentRepository: Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in ). Format: id::layout::url altReleaseDeploymentRepository: The alternative repository to use when the project has a final version.

What is the alternative repository to use when the project has?

User property is: altDeploymentRepository. The alternative repository to use when the project has a final version. User property is: altReleaseDeploymentRepository. The alternative repository to use when the project has a snapshot version.

What is altsnapshotdeploymentrepository?

User property is: altSnapshotDeploymentRepository. Whether every project should be deployed during its own deploy-phase or at the end of the multimodule build. If set to true and the build fails, none of the reactor projects is deployed. (experimental)


1 Answers

When altReleaseDeploymentRepository is specified, it is always used when the project has a release (or "final") version, i.e. is not a snapshot version. When altSnapshotDeploymentRepository is specified, it is always used when the project has a snapshot version. altDeploymentRepository is a default alternate deployment repository when none of the above repository were specified or used.

So to put it another way, if you have a release version, then:

  • altReleaseDeploymentRepository will be used if specified;
  • otherwise altDeploymentRepository will be used if specified;
  • otherwise the release remote repository declared in the <distributionManagement><repository> POM element will be used if specified;
  • otherwise the plugin will error because it didn't find any remote repository to deploy to.

Similarly, if you have a snapshot version, then:

  • altSnapshotDeploymentRepository will be used if specified;
  • otherwise altDeploymentRepository will be used if specified;
  • otherwise the snapshot remote repository declared in the <distributionManagement><snapshotRepository> POM element will be used if specified;
  • otherwise the release remote repository declared in the <distributionManagement><repository> POM element will be used if specified;
  • otherwise the plugin will error because it didn't find any remote repository to deploy to.
like image 168
Tunaki Avatar answered Oct 13 '22 00:10

Tunaki