如何配置maven项目以将快照和发布部署到Nexus?

如何配置maven项目以将快照和发布部署到Nexus?

问题描述:

如何配置maven项目以将快照和发布部署到Nexus?

How to configure maven project to deploy both snapshot and releases to Nexus?

<distributionManagement>
    <repository>
        <id>InternalReleases</id>
        <name>Internal Releases</name>
        <url>http://192.168.16.232:8081/nexus/content/repositories/releases/</url>
    </repository>
    <repository>
        <id>InternalSnapshots</id>
        <name>Internal Snapshots</name>
        <url>http://192.168.16.232:8081/nexus/content/repositories/snapshots/</url>
    </repository>
</distributionManagement>

此配置在Eclipse 3.8中使用m2e 1.2创建错误

This configuration creates error in Eclipse 3.8 with m2e 1.2

Project build error: Non-parseable POM D:\Workspaces\W\Parent\pom.xml: Duplicated tag: 'repository' (position: START_TAG 
 seen ...

当pom的版本为后缀时,我想要将工件部署到InternalSnapshots存储库使用-SNAPSHOT并在RELEASE时部署到InternalReleases存储库,这应该使用相同的pom.xml文件并执行相同的 mvn deploy 命令。

I want the artifact deployed to the InternalSnapshots repository when the pom's version is suffixed with -SNAPSHOT and deployed to the InternalReleases repository when it is RELEASE. This should happen using the same pom.xml file and executing the same mvn deploy command.

您需要区分版本和快照库。< distributionManagement> 只允许一个< repository> 和一个< snapshotRepository> child。

You need to distinguish between the releases and snapshots repository. <distributionManagement> only allows one <repository> and one <snapshotRepository> child.

http://maven.apache.org /pom.html#Distribution_Management