Maven release:perform without deploy and calling an external shell script

亡梦爱人 提交于 2020-02-17 06:13:09

问题


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. Somehow disable the default "deploy" goal from release:perform

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

Here is my 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>

回答1:


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.

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

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

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.

You could maybe use install instead of deploy.

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

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.




回答2:


A little late, but for reference:

For your step 1, you can disable the maven deploy step by using the "skip" option. Click here for reference.

On the commandline you could call something like:

mvn release:perform -Darguments="-Dmaven.deploy.skip=true"


来源:https://stackoverflow.com/questions/3445075/maven-releaseperform-without-deploy-and-calling-an-external-shell-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!