将http://www.mojohaus.org/exec-maven-plugin/exec-maven-plugin与指定安装阶段的“执行”配置块结合使用。确保它在您的 maven-install-plugin 之后,因为插件按顺序运行(在同一阶段内)
(in build/plugins)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>do-something.sh</executable>
<workingDirectory>/some/dir</workingDirectory>
<arguments>
<argument>--debug</argument>
<argument>with_great_effect</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
对于纯粹的 Maven 驱动方法,您正在寻找的答案是exec的目标exec-maven-plugin,并且此答案适用:https ://stackoverflow.com/a/2008258/3403663
编辑:OP 表明上述内容对他不起作用。
替代方法:我刚刚在自己的项目中尝试了以下方法,它ls在安装阶段的最后、部署工件之后执行。
mvn clean install exec:exec -Dexec.executable="/bin/ls" -Dexec.args="/etc"
否则,您总是可以将整个事情包装在脚本中:
#!/bin/bash
set -o errexit
mvn clean install
<your other commands here>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11031 次 |
| 最近记录: |