Girish
Girish

Reputation: 1717

Issue with maven deployment in snapshotRepository of Nexus

While using the snapshotRepository to deploy my artifact using maven with distributionManagement

<distributionManagement>
    <snapshotRepository>
      <uniqueVersion>true</uniqueVersion>
      <id>nexus</id>
      <name>nexus Snapshots</name>
      <url>http://127.0.0.1:8081/nexus/content/repositories/snapshots</url>
      <layout>legacy</layout>
    </snapshotRepository>
  </distributionManagement>

I m stuck into the error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.6: deploy (default-deploy) on project abc.parent: Deployment failed: repositor y element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

The error looks that it is searching for repository element inside distributionManagement but i have defined snapshotRepository as per http://maven.apache.org/plugins/maven-deploy-plugin/usage.html and when I replace token with and url inside this with nexus releases repository url it works fine , I have read many suggestions and few at stackoverflow as well with same error but still struggling........................

Upvotes: 0

Views: 1037

Answers (1)

Manfred Moser
Manfred Moser

Reputation: 29912

The version of your project determines if it is going to use. snapshotRepository is ONLY going to be used if you version ends in "-SNAPSHOT", otherwise it will use the repository element.

If you do NOT use a -SNAPSHOT version... it will just upload to the repository you specify. It will, by defintion, be a release repo. Also this has nothing to do with Nexus but rather with how the Maven repository format works. Snapshot repositories are different from release repos and if you have a release (version does not end in -SNAPSHOT) you should upload to a release repo.

Upvotes: 2

Related Questions