Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何配置maven项目以将快照和发布部署到Nexus?_Maven_Deployment_Nexus - Fatal编程技术网

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

如何配置maven项目以将快照和发布部署到Nexus?,maven,deployment,nexus,Maven,Deployment,Nexus,如何配置maven项目以将快照和发布部署到Nexus <distributionManagement> <repository> <id>InternalReleases</id> <name>Internal Releases</name> <url>http://192.168.16.232:8081/nexus/content/repositories

如何配置maven项目以将快照和发布部署到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>

我希望在pom的版本后缀为-SNAPSHOT时将工件部署到InternalSnapshots存储库,并在发布时将其部署到InternalReleases存储库。这应该使用相同的pom.xml文件并执行相同的
mvn deploy
命令来实现。

您需要区分版本和快照存储库<代码>只允许一个
和一个子


配置的示例
pom.xml

<!-- http://maven.apache.org/pom.html#Distribution_Management -->
<distributionManagement>
    <snapshotRepository>
        <id>InternalSnapshots</id>
        <name>Internal Snapshots</name>
        <url>http://192.168.16.232:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>InternalReleases</id>
        <name>Internal Releases</name>
        <url>http://192.168.16.232:8081/nexus/content/repositories/releases/</url>
    </repository>
</distributionManagement>
你两者都可以

添加
maven发布插件
2.5.3

运行以下命令:

mvn deploy clean:release release:prepare release:perform

配置文件允许使用不同的部分。如果您有多个配置文件,那么您可以使用不同的配置文件来完成它。这很好,但是它要求已经配置了maven和project,这就是问题的核心:如何配置
<server>   
    <id>thirdparty</id>   
  <username>deployment</username>
  <password>deployment123</password>
</server>
<server>
  <id>InternalReleases</id>
  <username>deployment</username>
  <password>deployment123</password>
 </server>  
<server>
  <id>InternalSnapshots</id>
  <username>deployment</username>
  <password>deployment123</password>
 </server>  
mvn deploy clean:release release:prepare release:perform