0

I'm trying to build an ear using the maven-ear-plugin from a war (and a few other resources, but forget that for now). Anyway, I'm trying to generate the application.xml file using the ear plugin.

My pom looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project 
    xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>my-ear-mvn</artifactId>
<name>My Ear</name>
<description>My Ear</description>
<packaging>ear</packaging>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.10.1</version>
        <configuration>
            <defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
            <skinnyWars>true</skinnyWars>
            <modules>
            <webModule>
                <groupId>org.my.app</groupId>
                <artifactId>my-web-war</artifactId>
                <bundleFileName>my-web.war</bundleFileName>
                <uri>my-web</uri>
                <context-root>MYWeb</context-root>
            </webModule>
            ...
            </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>      
...

And I get an application.xml file that looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC
    "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
      <display-name>my-ear-mvn</display-name>
      <description>My Ear</description>
      <module>
        <web>
          <web-uri>my-web</web-uri>
          <context-root>MYWeb</context-root>
        </web>
      </module>
    </application>

All well and good so far, the uri child element of the webModule element (from the pom) generates the corresponding web-uri child element of the web element in the application.xml. However, when I look at my ear, there is a file called my-web in the root of the ear where I would expect to see my-web.war. Sure enough, if I rename it to war, I can crack it open and it contains everything I would expect to see in that war.

Anyway, I can fix this? Thanks!

Kramer
  • 927
  • 2
  • 13
  • 30
  • Add `.war` to the label in the `` tags? http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-module-uri.html – scrappedcola Dec 05 '16 at 19:48
  • Yes, I suppose that would work. However, I am trying to "repackage" an existing ear application using maven. The existing application refrences web-uris that are not the same as the war names. For example: verifyservice/WebContent VerifyService – Kramer Dec 05 '16 at 20:56
  • That looks like the old EAR contained an exploded WAR module inside it. Is that right? – Steve C Dec 06 '16 at 02:48
  • i am running into the same problem still... could be the ancient maven 3.0.5 in use here? Its the 3.0.1 maven-ear -plugin also..... – U.V. Feb 14 '19 at 17:24

0 Answers0