Maven版本:无需部署和调用外部Shell脚本即可执行 [英] Maven release:perform without deploy and calling an external shell script

查看:286
本文介绍了Maven版本:无需部署和调用外部Shell脚本即可执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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. So I have two things to accomplish:

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

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

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

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

这是我的pom:

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <tagBase>svn://saoj-la.dyndns.org/webapp-test/tags</tagBase>
        <connectionUrl>scm:svn:svn://saoj-la.dyndns.org/webapp-test/trunk</connectionUrl>
    </configuration>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <executable>/bin/sh</executable>
        <arguments>
            <argument>run.sh</argument>
        </arguments>
    </configuration>
</plugin>

推荐答案

我正在使用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.

这篇关于Maven版本:无需部署和调用外部Shell脚本即可执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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