Maven发布:无需部署和调用外部shell脚本即可执行
我正在使用 Maven 发布插件。问题很简单:我不想在发布时进行部署:执行。我实际上想执行一个 shell 脚本来为我进行部署。所以我有两件事要完成:
以某种方式禁用release:perform中的默认“部署”目标
以某种方式使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>
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:
Somehow disable the default "deploy" goal from release:perform
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有点晚了,但仅供参考:
对于步骤 1,您可以使用“跳过”选项禁用 Maven 部署步骤。单击此处以供参考。
在命令行上你可以调用类似的命令:
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:
我一定错过了一些东西,因为当我读到这篇文章时,我没有看到剧本的重点……但我们只能说我不明白。
根据
release:perform
的文档,您可以使用可选的goals
参数指定:您也许可以使用
install
而不是deploy
。将其绑定在发布期间激活的配置文件中的
install
上。这是一种方法:但老实说,您的请求有些奇怪。也许提供更多细节会有所帮助。
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.
According to the documentation of
release:perform
, you can use the optionalgoals
parameter to specify:You could maybe use
install
instead ofdeploy
.Bind it on
install
in a profile activated during release. Here is one way to do this:But honestly, there is something weird with your request. Maybe giving more details would help.
如果您不想每次运行命令
mvn release:perform
时都输入-Darguments="-Dmaven.deploy.skip=true"
,您可以在中配置skip >pom.xml
If you do not want to type
-Darguments="-Dmaven.deploy.skip=true"
everytime you run the commandmvn release:perform
you can configure skip insidepom.xml