Maven 2 Maven release:在不部署和调用外部shell脚本的情况下执行
我正在使用maven发布插件。问题很简单:我不想在发布时部署:执行。实际上,我想执行一个shell脚本来为我进行部署。所以我有两件事要做:Maven 2 Maven release:在不部署和调用外部shell脚本的情况下执行,maven-2,maven-release-plugin,Maven 2,Maven Release Plugin,我正在使用maven发布插件。问题很简单:我不想在发布时部署:执行。实际上,我想执行一个shell脚本来为我进行部署。所以我有两件事要做: 以某种方式禁用发布时的默认“部署”目标:执行 以某种方式使release:perform调用exec:exec插件来执行shell脚本 这是我的pom: <plugin> <artifactId>maven-release-plugin</artifactId> <version>2.0<
<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发布插件
2
svn://saoj-la.dyndns.org/webapp-test/tags
scm:svn:svn://saoj-la.dyndns.org/webapp-test/trunk
org.codehaus.mojo
execmaven插件
执行官
/垃圾箱/垃圾箱
run.sh
我正在使用maven发布插件。问题很简单:我不想在发布时部署:执行。实际上,我想执行一个shell脚本来为我进行部署
我一定错过了什么,因为当我读到这篇文章时,我不明白脚本的意义。。。但我得说我不明白
以某种方式禁用发布时的默认“部署”目标:执行
根据release:perform
的文档,您可以使用可选参数指定:
部署时要执行的目标的空格分隔列表。如果项目具有/
元素,则默认值为deploy
或deploy site deploy
您可以使用install
而不是deploy
以某种方式使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>
释放
性能释放酶
真的
...
但老实说,你的要求有些奇怪。也许提供更多细节会有所帮助。有点晚,但仅供参考: 对于步骤1,可以使用“跳过”选项禁用maven部署步骤。点击查看 在命令行中,您可以调用如下内容:
mvn release:perform -Darguments="-Dmaven.deploy.skip=true"
使用安装开关“部署”来“安装”任务。谢谢安装exec:exec就足够了,但是release:perform不喜欢exec:exec:@Sergio哦,这不是我建议的,我不确定这是否可行。嘿,帕斯卡。你的建议也行不通。因为release:perform派生了另一个进程,所以不知何故该概要文件没有被激活。另一个问题是标签,因为release:perform是一个目标,而不是一个阶段。总之:我的解决方案是在release:perform之后强制用户手动调用exec:exec。没有简单的方法在release:perform之后级联exec:exec。我不喜欢Maven的这一点。简单的事情变得极其困难。有了蚂蚁,你可以完成任何你想做的事情。不是说蚂蚁更好,只是它尊重接吻原则。@Sergio Weird,个人资料对我来说确实有用。其次,我明确地编写了尝试在
install
阶段绑定,而不是release:perform
。第三,我不想讨论KISS(这可能有争议,但您的用例看起来不像KISS),但如果Maven不能像您希望的那样工作,我的建议是不要使用它。@Sergio在MAC上不应该是一个问题,至少在理论上是这样。我无法轻松测试您的场景,因此我恐怕无法提供进一步的帮助(我仍然认为在概要文件中的某个阶段绑定exec:exec
),我的用例是:将SVN repos迁移到Git,并希望验证pom.xml中的SCM URL。运行mvn发布:准备;mvn release:perform-Darguments=“-Dmaven.deploy.skip=true”
允许我在我的fork中发布假版本,而不是将假工件推送到artifactory