且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven版本:无需部署和调用外部Shell脚本即可执行

更新时间:2023-12-05 15:05:46

我正在使用Maven发布插件.问题很简单:我不想在release:perform上进行部署.我实际上想执行一个shell脚本,该脚本将为我完成部署.

I am using the maven release plugin. Problem is simple: I don't want to do a deploy on release:perform. I actually want to execute a shell script that will do the deploy for me.

我一定想念一些东西,因为当我读到这篇文章时,我看不到脚本的要点...但是让我们说我不明白.

I must be missing something because when I read this, I don't see the point of the script... But let's just say I don't get it.

以某种方式从release:perform禁用默认的部署"目标

Somehow disable the default "deploy" goal from release:perform

根据release:perform的文档,您可以使用可选的 goals 参数来指定:

According to the documentation of release:perform, you can use the optional goals parameter to specify:

以空格分隔的要在部署时执行的目标列表.如果项目具有<distributionManagement>/<site>元素,则默认值为deploydeploy site-deploy.

A space separated list of goals to execute on deployment. Default value is either deploy or deploy site-deploy, if the project has a <distributionManagement>/<site> element.

您可以使用install代替deploy.

以某种方式使release:perform调用exec:exec插件来执行Shell脚本

Somehow make release:perform call the exec:exec plugin to execute a shell script

在发布期间激活的配置文件中将其绑定在install上.这是执行此操作的一种方法:

Bind it on install in a profile activated during release. Here is one way to do this:

<profile>
  <!-- Profile used when the release plugin executes. -->
  <id>release</id>
  <activation>
    <property>
      <!-- This property is automatically defined by the Maven release plugin when executing
           a release. Thus this profile will be automatically enabled when releasing -->
      <name>performRelease</name>
      <value>true</value>
    </property>
  </activation>
  <build>
    ...
  </build>
</profile>

但是,老实说,您的要求有些奇怪.也许提供更多详细信息会有所帮助.

But honestly, there is something weird with your request. Maybe giving more details would help.