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?
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;