简体   繁体   English

作为maven版本的一部分运行自定义插件,但在版本更新到下一个快照之前

[英]Run custom plugin as part of the maven release but before the version is updated to the next snapshot

I have written a Maven plugin which will call a web service with details about my project including the version number. 我编写了一个Maven插件,它将调用一个Web服务,其中包含有关我的项目的详细信息,包括版本号。 I only want to run this when my project is released, not on the deployment of snapshots. 我只想在我的项目发布时运行它,而不是在部署快照时运行它。

I have a Jenkins job that manages the build/deploy/release process. 我有一个管理build/deploy/release过程的Jenkins工作。 If I modify the Release Goals and Options from 如果我修改发布目标和选项

-Dresume=false release:prepare release:perform --debug to -Dresume=false release:prepare release:perform --debug to

-Dresume=false release:prepare release:perform my-plugin:dostuff --debug

Will that achieve what I want? 这会实现我想要的吗? Or will the release:perform to the build and deployment of my release version and then update the POM to the next snapshot version before my plugin runs? 或者发布:执行我的发布版本的构建和部署,然后在我的插件运行之前将POM更新到下一个快照版本?

If so is there a way to achieve what I want which is, on running the Jenkins job to perform the release of 1.0, have the release plugin update the POM to 1.0, build it and deploy it then run my plugin to call the web service before having the release plugin update the version to 1.1-SNAPSHOT. 如果是这样,有一种方法可以实现我想要的,在运行Jenkins作业以执行1.0的发布时,让发布插件将POM更新为1.0,构建它并部署它然后运行我的插件来调用Web服务在发布插件之前将版本更新为1.1-SNAPSHOT。

Thanks, Paul 谢谢,保罗

You can add your plugin to the POM, configuring it to run in an appropriate phase of the standard lifecycle. 您可以将插件添加到POM,将其配置为在标准生命周期的适当阶段运行。 Additionally, you can program your plugin to only perform the action when a release is happening, ie by checking whether the version of the project ends with -SNAPSHOT . 此外,您可以将插件编程为仅在发布时执行操作,即通过检查项目的版本是否以-SNAPSHOT

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

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