使用Jenkins Job将War文件上传到Nexus [英] Uploading war file to Nexus using jenkins job

查看:167
本文介绍了使用Jenkins Job将War文件上传到Nexus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个zip文件,其中包含这样的版本xxx_1.2.3.zip,现在我创建了一个jenkins作业,该作业将运行并使用build.xml在Nexus中上载该zip.

I have a zip file which contains version like this xxx_1.2.3.zip now i created one jenkins job which will run and upload the zip in nexus using build.xml.

我的问题是我想解压缩并找到war文件,并想将zip和war文件上传到nexus.我能够使用以下代码进行操作,但它不存储具有其原始名称的war文件工件ID和组ID.Zip包含yyy.war.当我存储到nexus时,它应该像yyy_1.2.3.war一样上载.但是存储为xxx-jenkins build number.war.

My question is i want to unzip and find the war file and want to upload zip and war file to nexus.i am able to do using below code but it is not storing the war file with its original name artifact id and group id.Zip contains yyy.war.when i stores to nexus it should upload like yyy_1.2.3.war.But is is storing as xxx-jenkins build number.war.

请帮助.谢谢.

 unzip ${xxx_ReleaseVersion}
 echo "<project> <modelVersion>4.0.0</modelVersion><groupId>zzz</groupId> <artifactId>xxx</artifactId> <version>${BUILD_NUMBER}  </version>       <packaging>pom</packaging> </project>" > pom.xml
 echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"no\"?>
 <project basedir=\".\" name=\"xxx\" default=\"deploy\"    xmlns:artifact=\"antlib:org.apache.maven.artifact.ant\">
 <artifact:pom id=\"mypom\" file=\"pom.xml\" />
 <target name=\"deploy\">       
 <artifact:deploy file=\"pom.xml\">
 <remoteRepository url=\"https://URL/nexus/content/repositories/xxx\">
    <authentication username=\"xxxx\" password=\"1234\" />
 </remoteRepository>
 <pom refid=\"mypom\"/> 
 <attach file=\"${xxx_ReleaseVersion}\" type=\"zip\"/> " > build.xml
 find . -type f -name "*.war" -exec echo "<attach file=\"{}\"type=\"war\"/> "   >> build.xml \;
 echo "</artifact:deploy>
 </target>
 </project>  " >> build.xml

  pwd

推荐答案

您可以使用Nexus-Artifact-Uploader插件,但每次要构建时都必须手动更改版本ID

you can use Nexus-Artifact-Uploader plugin but you have to change the version id manually every time you want build

这篇关于使用Jenkins Job将War文件上传到Nexus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆