我正在尝试将构建jenkins / maven的结果发布到Nexus存储库 .
构建是一场战争SNAPSHOT,这里是POM的开始:
<http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.elis</groupIenter code hered>
<artifactId>accueil_ce</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>accueil_ce</name>
我使用 clean install maven目标进行构建 .
我已经为jenkins安装并配置了 Nexus Repository Manager Publisher 插件,因此它可以在后期构建步骤中发布到我的nexus Repo .
问题是 :
-
如果我在Nexus中将repo配置为'snapshot'和'allow redeploy',则在配置作业的After build步骤'Nexus Repository Manager Publisher'时,它不会出现在Jenkins中可用的repos列表中 .
-
如果我在Nexus中将repos配置为'release'和'allow redeploy',那么在运行jenkins作业时出现以下错误:
java.io.IOException:com.sonatype.nexus.api.exception.RepositoryManagerException: Unable to upload component: Bad Request The version 0.0.1-SNAPSHOT does not match the repository policy!
我不明白,有没有办法用这个插件从jenkins build发布SNAPSHOT到nexus?
1 回答
您需要向pom添加分发管理以控制快照和释放回购 .
见https://maven.apache.org/pom.html#Distribution_Management和How to configure maven project to deploy both snapshot and releases to Nexus?