maven-ear-plugin 忽略模块的解包选项

发布于 2024-10-30 20:18:41 字数 2707 浏览 3 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘然心甜 2024-11-06 20:18:41

我错误地认为 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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文