Maven deploy "distributionManagement section ... not specified" in CI
maven-deploy-plugin needs a target repository from <distributionManagement> in the POM. None is defined, so the goal has nowhere to upload and fails before any transfer.
What this error means
deploy fails with "Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=...".
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project app:
Deployment failed: repository element was not specified in the POM inside
distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]Common causes
No distributionManagement in the POM
The project (or its parent) never declares where to deploy, so the plugin has no repository URL.
Deploy runs without an altDeploymentRepository
The job calls deploy without -DaltDeploymentRepository, and the POM provides no target either.
How to fix it
Declare distributionManagement
Add release and snapshot repositories so the deploy goal knows where to publish.
<distributionManagement>
<repository>
<id>nexus</id>
<url>https://nexus.example.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>https://nexus.example.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>Or pass an alt deployment repository
Specify the target inline if you cannot edit the POM.
mvn -B deploy \
-DaltDeploymentRepository=nexus::default::https://nexus.example.com/repository/maven-releases/How to prevent it
- Declare
distributionManagementin the parent POM once. - Match its
<id>to a server entry in settings.xml. - Keep release and snapshot URLs distinct.