如果在 Maven 3.x 中设置了系统属性 id,如何运行 exec-maven-plugin?
如果设置了系统属性,我想运行“exec-maven-plugin”。如何在 Maven 3.x 中完成此操作?
例如,给定:
mvn clean install -DrunTheExec="yes"
那么我该如何实现这个逻辑:
<!-- if $(runTheExec) == yes then run this plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
...
</plugin>
I want to run the 'exec-maven-plugin' if a system property is set. How do I accomplish this in Maven 3.x?
For example, given:
mvn clean install -DrunTheExec="yes"
Then how can I implement this logic:
<!-- if $(runTheExec) == yes then run this plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
...
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正要添加与 Johnathon 相同的建议,但使用配置文件略有不同。
然后激活它:
I was just about to add the same suggestion as Johnathon, but using the profile a little differently.
then to activate it:
您需要在 pom 中定义一个配置文件,并在其中定义插件。在您的示例中,这将是:
You'll need to define a profile in your pom, with the plugin defined inside of it. In your example, this would be: