简体   繁体   English

从jenkins / maven build将SNAPSHOT发布到nexus

[英]Publishing SNAPSHOT to nexus from jenkins/maven build

I'm trying to publish the result of a build jenkins/maven to a Nexus repository. 我正在尝试将构建jenkins / maven的结果发布到Nexus存储库。

The build is a war SNAPSHOT, here is the beginning of the POM : 构建是一场战争快照,这是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>

I use clean install maven goals for the build. 我使用全新安装的 Maven目标进行构建。

I've installed and configure the Nexus Repository Manager Publisher plugin for jenkins so it can publish to my nexus Repo in a post build step. 我已经为jenkins安装并配置了Nexus Repository Manager Publisher插件,以便可以在构建后的步骤中将其发布到我的nexus Repo中。

The problem is : 问题是 :

  • if I configure the repo as 'snapshot' and 'allow redeploy' in Nexus, it doesnt appear in the list of repos available in Jenkins, when configuring the after build step 'Nexus Repository Manager Publisher' of the job. 如果我在Nexus中将仓库配置为“快照”和“允许重新部署”,则在配置作业的构建后步骤“ Nexus Repository Manager Publisher”时,它不会出现在Jenkins可用的仓库清单中。

  • if I configure the repos as 'release' and 'allow redeploy' in Nexus, then I got the following error when running the jenkins job : 如果我在Nexus中将存储库配置为“发布”和“允许重新部署”,则在运行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! java.io.IOException:com.sonatype.nexus.api.exception.RepositoryManagerException:无法上传组件:错误的请求0.0.1-SNAPSHOT版本与存储库策略不匹配!

I don't understand, there is no way to publish SNAPSHOTs to nexus from jenkins builds with this plugin ?? 我不明白,没有办法从使用此插件的jenkins版本向nexus发布SNAPSHOT吗?

You need to add distribution management to you pom to control snapshot and release repos. 您需要在pom中添加分发管理以控制快照和发布存储库。

See https://maven.apache.org/pom.html#Distribution_Management and How to configure maven project to deploy both snapshot and releases to Nexus? 请参阅https://maven.apache.org/pom.html#Distribution_Management如何配置maven项目以将快照和发行版都部署到Nexus?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM