mvn部署问题

时间:2011-12-08 07:03:36

标签: maven maven-2 nexus

我正在使用maven 3.0.3和nexus&詹金斯

的pom.xml

<distributionManagement> 
         <repository>
            <id>releases</id>
                               <url>http://xxx.xxx.xx.xx:8383/nexus/content/repositories/releases</url>
        </repository>

         <!-- Publish the versioned releases here -->
         <snapshotRepository>
          <id>releases</id>
          <name>nexus</name>
          <url>http://xxx.xxx.xx.xx:8383/nexus/content/repositories/snapshots</url>
         </snapshotRepository>
    </distributionManagement>

的settings.xml

<servers>
<server>
<username>admin</username>
<password>bala</password>
<id>releases</id>
</server>
</servers>

当我执行mvn deploy

我收到以下错误。想知道我错过了哪里,我错过了什么?

---------------------------------------------------------------------

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

-------------------------------------------------

1 个答案:

答案 0 :(得分:1)

快照存储库的<id>与版本存储库相同。以不同方式命名它们,然后在settings.xml文件中输入两个服务器定义。同时为发布存储库提供<name>。像这样:

<distributionManagement> 
         <repository>
            <id>releases</id>
            <name>nexus releases</name>
            <url>http://xxx.xxx.xx.xx:8383/nexus/content/repositories/releases</url>
        </repository>

         <!-- Publish the versioned releases here -->
         <snapshotRepository>
            <id>snapshots</id>
            <name>nexus snapshots</name>
            <url>http://xxx.xxx.xx.xx:8383/nexus/content/repositories/snapshots</url>
         </snapshotRepository>
    </distributionManagement>

的settings.xml

<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>bala</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>bala</password>
</server>
</servers>