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?
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.
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.
So, the answer is yes, mvn deploy will execute install and build the project artifacts.
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.
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.
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.
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.
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)
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;altDeploymentRepository
will be used if specified;<distributionManagement><repository>
POM element will be used if specified;Similarly, if you have a snapshot version, then:
altSnapshotDeploymentRepository
will be used if specified;altDeploymentRepository
will be used if specified;<distributionManagement><snapshotRepository>
POM element will be used if specified;<distributionManagement><repository>
POM element will be used if specified;If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With