Installed Nexus on our server and set up a snapshot and a releases repositories.
Altered my pom.xml file of the top project in my sub-module maven project, added these lines:
<distributionManagement>
<snapshotRepository>
<id>Snapshots</id>
<url>http://maven:8081/nexus/content/repositories/Snapshots</url>
</snapshotRepository>
<repository>
<id>Releases</id>
<url>http://maven:8081/nexus/content/repositories/Releases</url>
</repository>
</distributionManagement>
I've added a settings.xml to .m2 directory with the following contents:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
-->
<servers>
<server>
<id>Snapshots</id>
<username>user</username>
<password>pass</password>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
<!--
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
-->
</settings>
When I run maven with deploy goal from eclipse on my top project, maven starts to build and syncing (uploading) to the snapshots repo. The top project gets uploaded but after the first sub module is built and started to sync I keep getting:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project <my sub module project>: Failed to deploy artifacts: Could not transfer artifact <group id>:<artifact id>:xml:0.0.1-20130318.160312-21 from/to Snapshots (http://maven:8081/nexus/content/repositories/Snapshots): Remotely Closed [id: 0x017ae341, /192.168.10.237:58758 :> maven/192.168.10.36:8081]
The weird thing is that if I browse my repo from Nexus interface the sub project is there with xml's and jar's etc. Problem though is that because of the error maven stops and all my other sub projects isn't deployed.
Anyone know how to resolve this?
UPDATE: If I create a single maven project with distributionManagement-tag I can deploy without problems to Nexus. But when having multi maven project I get the error. I tried to add distributionManagement to child-pom to but I get the same error.
How should the poms look like en deploying to a repository regarding distributionManagement tag ?