I have a project pom that specifies:
<groupId>net.example.myspace</groupId>
<artifactId>myproject</artifactId>
<version>0.9.0-SNAPSHOT</version>
<packaging>pom</packaging>
and I have specified a repository to deploy to via altSnapshotDeploymentRepository
. This used to work in my other projects, but this time, the Maven build fails when trying to deploy the build artifacts, complaining:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project myproject:
Deployment failed: repository element was not specified in the POM inside
distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
-> [Help 1]
Adding altDeploymentRepository
helped, but the docs say that snapshots are deployed to altSnapshotDeploymentRepository
, while altDeploymentRepository
is only used if the artifact is neither recognized as a snapshot nor as a release. So the question is, why doesn't Maven recognize a snapshot build here?
I've always assumed that the -SNAPSHOT
suffix is how Maven determines a snapshot version, but it doesn't seem to work this way here? Or perhaps I'm overlooking something?
The error is due to the version of maven-deploy-plugin
used. As per the plugin documentation, <altReleaseDeploymentRepository>
and <altSnapshotDeploymentRepository>
parameters are present only from version 2.8
. As per the error message above, the plugin version is 2.7
.
You can upgrade maven-deploy-plugin
to fix the issue.