maven-ear-plugin 忽略模块的解包选项
我有一个 Java EE 6 EAR 项目,其中包含几个模块(jar 和 ejb)。使用 maven-ear-plugin 组装 EAR 文件,我基本上希望所有工件被打包/解压:
来自父文件的 pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<inherited>true</inherited>
<configuration>
<encoding>UTF-8</encoding>
<version>5</version>
<generateApplicationXml>true</generateApplicationXml>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<manifestEntries>
<app-version-info>${app-version-info}</app-version-info>
</manifestEntries>
</archive>
</configuration>
</plugin>
来自Ear 文件的 pom.xml
:
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<configuration>
<finalName>heap-poc</finalName>
<modules>
<jarModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-common</artifactId>
<bundleFileName>poc-common.jar</bundleFileName>
<unpack>true</unpack>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<jarModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-persistence</artifactId>
<bundleFileName>poc-persistence.jar</bundleFileName>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<ejbModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-business</artifactId>
<unpack>false</unpack>
<bundleFileName>poc-business.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
问题在于 描述的 unpack-switch 似乎被完全忽略:
- poc-common.jar (unpack=true) 被打包
- poc-persistence.jar (没有定义 unpack) 被打包
- poc-business.jar (unpack=false) )已爆炸
我正在使用 Eclipse Helios / m2eclipse,但根据我的理解,这对问题来说应该不重要。
有人可以把我推向正确的方向吗?
I have an Java EE 6 EAR-project with a couple of modules (jars & ejb). Assembling the EAR-file with the maven-ear-plugin, I basically want all artifacts to be packed / unexploded:
from the pom.xml
of the parent file:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<inherited>true</inherited>
<configuration>
<encoding>UTF-8</encoding>
<version>5</version>
<generateApplicationXml>true</generateApplicationXml>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<manifestEntries>
<app-version-info>${app-version-info}</app-version-info>
</manifestEntries>
</archive>
</configuration>
</plugin>
from the pom.xml
of the ear file:
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<configuration>
<finalName>heap-poc</finalName>
<modules>
<jarModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-common</artifactId>
<bundleFileName>poc-common.jar</bundleFileName>
<unpack>true</unpack>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<jarModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-persistence</artifactId>
<bundleFileName>poc-persistence.jar</bundleFileName>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<ejbModule>
<groupId>com.example.heap</groupId>
<artifactId>poc-business</artifactId>
<unpack>false</unpack>
<bundleFileName>poc-business.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
The problem is that the described unpack-switch seems to be completely ignored:
- poc-common.jar (unpack=true) is packed
- poc-persistence.jar (no unpack defined) is packed
- poc-business.jar (unpack=false) is exploded
I'm working with Eclipse Helios / m2eclipse, but from my understanding this shouldn't matter much for the problem.
Can someone push me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我错误地认为 Eclipse 不负责该问题。事实上,maven 从命令行做了它应该做的事情,它“只是”m2-eclipse 和 jboss-tools 的相当复杂的集成,它似乎忽略了有问题的设置。
mvn package
确实做了它应该做的事情 :-)将基于 ant 的 Java EE 5 项目迁移到 Maven 和 Java EE 6 的整整一周教会了我在 Eclipse 中的 JBoss 上使用 Maven 的艰难方法与命令行上的 Maven 有很大不同......
I was wrong with my assumption that Eclipse is not responsible for the problem. As a matter of fact, maven from the command line does what it's supposed to do, it's "just" the rather complex integration of m2-eclipse and jboss-tools which seems to ignore the settings in question.
mvn package
does exactly do what it's supposed to do :-)A whole week of migrating an ant-based Java EE 5 project to maven and Java EE 6 taught me the hard way that Maven on JBoss in Eclipse is a whole lot different than Maven on the command line...