我使用maven为我的应用程序创建war文件。war文件反过来使用一些第三方库。该应用程序在JBoss4.x上运行。现在我们要搬到Jboss 7。
一些第三方库默认是在Jboss 6中提供的,因此我不想在构建war文件时包含它们。
我的问题是,我需要支持为两个版本的Jboss构建war文件,而不需要做太多的更改。我需要在war文件中包含第三方库,如果我希望将它部署到4.x中,但不希望在为Jboss7进行构建时包含它。
我看了maven的依赖性,但我认为不是这样的。有什么办法让我做到这一点吗。
发布于 2014-08-14 10:32:11
您可以使用maven配置文件,并为不同的JBoss版本添加配置文件。
有关更多信息,请参见:Different dependencies for different build profiles in maven
然后,计划将“根级别”上的所有公共依赖项(wars、jars、poms)和配置文件中的特定依赖项包括在内。
<profiles>
<profile>
<id>jboss-7</id>
<dependencies>
<!-- the special jboss 7 dependencies -->
</dependencies>
</profile>
<profile>
<id>jboss-4</id>
<dependencies>
<!-- the special jboss 4 dependencies -->
</dependencies>
</profile>
</profiles>https://stackoverflow.com/questions/25305820
复制相似问题