28

我正在使用 Maven 发布插件。问题很简单:我不想在发布时进行部署:执行。我实际上想执行一个 shell 脚本来为我进行部署。所以我有两件事要完成:

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

  2. 不知何故 make release:perform 调用 exec:exec 插件来执行一个 shell 脚本

这是我的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>
4

2 回答 2

53

有点晚了,但供参考:

对于您的第 1 步,您可以使用“跳过”选项禁用 Maven 部署步骤。单击此处以供参考。

在命令行上,您可以调用类似:

mvn release:perform -Darguments="-Dmaven.deploy.skip=true"
于 2014-04-22T14:21:01.570 回答
11

我正在使用 Maven 发布插件。问题很简单:我不想在发布时进行部署:执行。我实际上想执行一个 shell 脚本来为我进行部署。

我一定是遗漏了一些东西,因为当我读到这篇文章时,我看不出剧本的意义……但是让我们说我不明白。

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

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

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

您也许可以使用install而不是deploy.

不知何故 make release:perform 调用 exec:exec 插件来执行一个 shell 脚本

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

<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>

但老实说,你的要求有些奇怪。也许提供更多细节会有所帮助。

于 2010-08-10T00:33:42.547 回答