我使用maven打包我的应用程序。现在我只想在调试版本中集成泄漏。所以我需要在我的pom.xml中添加一个<dependency>
节点。但我想从发布版本中删除它。我怎样才能做到这一点?我有一个解决方案,一个用于调试版本的pom.xml和另一个用于发布版本的pom。另一个解决方案是使用shell在包之前修改pom.xml。还有更好的主意吗?
行家:3.3.9
com.simpligility.maven.plugins:机器人-行家-插件:4.4.3
答案 0 :(得分:0)
你可以用Maven profiles来做到这一点;它们可以托管多个POM元素:属性值,配置,依赖性等
然后,当从命令行运行时,您可以使用-P
启用其中一个或多个配置文件,例如在Eclipse中,具有Run as...
窗口中的特定条目。
以下是一个简短的例子:
<!-- Dependencies declarations -->
</dependencies>
<profiles>
<profile>
<id>extralib</id>
<properties>
<!-- specify property values here -->
</properties>
<dependencies>
<dependency>
<!-- add dependency decl here -->
<dependency>
</dependencies>
</profile>
<!-- you may have several profiles -->
<profile>
的所有孩子都是可选的。