[英]Jenkins + Maven - How to execute shell script before release:perform cleans the project
I have a Maven project that generates a zip file with maven-assembly-plugin on mvn package 我有一个Maven项目,该项目在mvn包上使用maven-assembly-plugin生成一个zip文件
MyProy
|--pom
|--src/...
|--target
|---MyProy-something-1.0.0-SNAPSHOT-zip (contains /1.0.0-SNAPSHOT/...)
I created a Jenkins job and configured a shell script execution as a post step. 我创建了一个Jenkins作业,并在后续步骤中配置了Shell脚本执行。 This script copies the zip to a folder (/something) and unzips it
该脚本将zip复制到文件夹(/某物)并解压缩
|-/something
|---1.0.0-SNAPSHOT
|---...
This works fine for builds. 这适用于构建。 However I want to do the same when I launch a release.
但是,当我发布一个版本时,我想做同样的事情。 I installed Jenkins release plugin and in "configure release build" I added this tasks:
我安装了Jenkins发布插件,并在“配置发布版本”中添加了以下任务:
mvn release:prepare
mvn release:prepare
mvn release:perform
mvn release:perform
I see the mvn release:perform
execute correctly, for instance with version 1.0.0 but the problem is that when the script (3.) is launched it applies to the next development version (1.0.1-SNAPSHOT) instead of the release version (1.0.0). 我看到
mvn release:perform
正确执行,例如使用1.0.0版,但是问题是启动脚本(3.)时,它适用于下一个开发版本(1.0.1-SNAPSHOT),而不是发行版(1.0.0)。
This is how I managed to work around the problem: 这是我设法解决此问题的方法:
Before release build 发布前构建
After successful release build 成功发布后
To sum up, after the release:perform I checkout the brand new tag, execute a clean install in the location of the downloaded tag and finally I execute the script that copies the zip and unzipes it. 总而言之,在release:perform之后,我签出全新的标签,在下载的标签的位置执行全新安装,最后执行复制zip并将其解压缩的脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.