nexus - Why is Maven uploading incorrectly snapshots to release repository? -
i'm trying use maven-deploy-plugin upload releases , snapshots nexus repository. run across error
[info] [deploy:deploy {execution: default-deploy}] [info] retrieving previous build number nexus uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.jar 56k uploaded (edr-app-1.0.4-20120605.140242-20.jar) [info] uploading project information edr-app 1.0.4-20120605.140242-20 [info] retrieving previous metadata nexus [info] uploading repository metadata for: 'artifact info.afilias.edr:edr-app' [info] retrieving previous metadata nexus [info] uploading repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-snapshot' [info] retrieving previous build number nexus uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.tar.gz 4286k uploaded (edr-app-1.0.4-20120605.140242-20.tar.gz) [info] [deploy:deploy-file {execution: default}] uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4/edr-app-1.0.4.tar.gz 89530k uploaded (edr-app-1.0.4.tar.gz) [info] uploading project information edr-app 1.0.4 [info] retrieving previous metadata remote-repository [info] uploading repository metadata for: 'artifact info.afilias.edr:edr-app' [info] retrieving previous build number remote-repository [info] repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-snapshot' not found on repository: remote-repository, created uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.tar.gz [info] ------------------------------------------------------------------------ [error] build error [info] ------------------------------------------------------------------------ [info] error deploying attached artifact /home/mren/trunk2/target/edr-app-1.0.4-snapshot.tar.gz: error deploying artifact: failed transfer file: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.tar.gz. return code is: 400 here's configuration in pom.xml:
<project> ... <distributionmanagement> <repository> <id>releases</id> <name>releases</name> <url>http://localhost:8081/nexus/content/repositories/releases</url> </repository> <snapshotrepository> <id>snapshots</id> <name>snapshots</name> <url>http://localhost:8081/nexus/content/repositories/snapshots</url> </snapshotrepository> </distributionmanagement> ... <build> ... <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-deploy-plugin</artifactid> <version>2.7</version> <executions> <execution> <phase>deploy</phase> <goals> <goal>deploy-file</goal> </goals> <configuration> <file>target/edr-install-1.0.4-${revision}.tar.gz</file> <url>${project.distributionmanagement.repository.url}</url> <packaging>tar.gz</packaging> <artifactid>artifactid</artifactid> <groupid>groupid</groupid> <version>1.0.4-${revision}</version> </configuration> </execution> </executions> </plugin> ... </build> ... </project> and settings.xml file:
<settings> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers> <profiles> <profile> <id>nexus</id> <activation> <activebydefault>true</activebydefault> </activation> <repositories> <repository> <id>releases</id> <name>releases</name> <url>http://localhost:8081/nexus/content/repositories/releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>snapshots</id> <name>snapshots</name> <url>http://localhost:8081/nexus/content/repositories/snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> </settings> i'm sure configuration worked @ 1 point, it's spitting out error. not sure wrong.
and nexus log tells me it's trying upload snapshot release repository
jvm 1 | 2012-06-04 14:16:31 info [tp1706427008-35] - org.sonatype.nexus.proxy.maven.maven2.m2repository - storing of item releases:/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120604.181534-1.tar.gz forbidden maven repository policy. because releases release repository jvm 1 | 2012-06-04 14:16:31 error [tp1706427008-35] - org.sonatype.nexus.rest.contentplexusresource - got exception during processing request "put http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120604.181534-1.tar.gz": storing of item releases:/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120604.181534-1.tar.gz forbidden maven repository policy. because releases release repository
your settings.xml incorrect. please configure maven use nexus correctly following book chapter. use mirror settings , url in there , not specific urls repository , pluginrepository.
it interferes correct maven pom , ends trying deploy snapshot release repository, incorrect.
in addition important use correct goal/command. not use deploy-file goal directly or so.
just run command
mvn clean deploy
on build.
and clarification. maven deploy whatever determined version. if ends in -snasphot is development version , published snapshot repo (and allow redeploys incrementing version number) , if not considered release , deploy release repo. project can not snapshot , release @ same time. 1 or other.
do not mix 2 concepts of release , snapshot!
and in terms of getting additional artifacts deployed either pull them out separate project/module if not associated or if attach-artifact goal of build helper plugin.
Comments
Post a Comment