1

I have a project where I need that my WAR file for the project should get build inside my EAR using maven build tool. I need to configure maven-ear-plugin for that. I configured the maven-war-plugin and it is working fine.

Can anybody please help me out in configuring maven-ear-plugin or do in need to do anything else.

I also do not know the significance of application.xml that get generated with maven-ear-plugin

<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>
  <groupId>com.Avizva.FBVision</groupId>
  <artifactId>Enrollment_GUID</artifactId>
  <packaging>ear</packaging>
  <name>Enrollment_GUID</name>
  <build>
    <sourceDirectory>${basedir}/src</sourceDirectory>
<resources>
      <resource>
        <directory>${basedir}/src</directory>
        <includes>
        <include>**/*.properties</include>
         <include>**/*.java</include>
        </includes>

      </resource>
    </resources>
    <plugins>
    <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
        <generateApplicationXml>false</generateApplicationXml>
        <finalName>Enrollment_GUID.war</finalName>
        <modules>
        <webModule>
                <groupId>${project.groupId}</groupId>
                <artifactId>Enrollment_GUID-war</artifactId>
                <bundleFileName>Enrollment_GUID.war</bundleFileName>
                <contextRoot>/Enrollment_GUID</contextRoot>
        </webModule>

        </modules>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>


      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>

          <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
          <warName>Enrollment_GUID</warName>
          <packagingIncludes>WEB-INF/lib/*.jar,WEB-INF/wsdl/*.xsd,WEB-INF/wsdl/*.wsdl,WEB-INF/properties/*.properties,**/*.xml</packagingIncludes>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
      <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <version>2.4</version>
      <configuration>
        <encoding>UTF-8</encoding>
      </configuration>
    </plugin>
    </plugins>

  </build>
  <dependencies>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-1.2-api</artifactId>
        <version>2.0-rc1</version>
    </dependency>

    <dependency>
        <groupId>org.kie.modules</groupId>
        <artifactId>org-apache-commons-lang3</artifactId>
        <version>6.1.0.CR1</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jdk14</artifactId>
        <version>1.7.7</version>
    </dependency>
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.3</version>
</dependency>
    <dependency>
        <groupId>org.apache.directory.studio</groupId>
        <artifactId>org.apache.commons.lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.5.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-asm</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
    <groupId>net.sf.dozer</groupId>
    <artifactId>dozer</artifactId>
    <version>5.3.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-transport-local</artifactId>
    <version>1.6.2</version>
    </dependency>
    <dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-transport-http</artifactId>
    <version>1.6.2</version>
    </dependency>
    <dependency>
    <groupId>org.apache.ws.commons.axiom</groupId>
    <artifactId>axiom-api</artifactId>
    <version>1.2.13</version>
    </dependency>
    <dependency>
    <groupId>org.apache.ws.commons.axiom</groupId>
    <artifactId>axiom-impl</artifactId>
    <version>1.2.13</version>
    </dependency>
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.5</version>
    </dependency>
    <dependency>
        <groupId>aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.5.4</version>
    </dependency>
    <dependency>
    <groupId>org.apache.ws.schema</groupId>
    <artifactId>XmlSchema</artifactId>
    <version>1.4.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient-cache</artifactId>
        <version>4.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.2.3</version>
    </dependency>
  </dependencies>

  <version>1</version>
</project>
user2439680
  • 11
  • 1
  • 3
  • Check http://stackoverflow.com/questions/5167024/how-to-add-war-inside-ear-with-maven – seenukarthi Jun 30 '14 at 06:00
  • I tried it but it is not working for me I am getting the following error when i Used it in my pom.xml [ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.9.1:generate-application-xml (default-generate-application-xml) on project Enrollment_GUID: Artifact[war:com.Avizva.FBVision:Enrollment_GUID-war] is not a dependency of the project. -> [Help 1] What is the significance of application.xml here and how to configure it. – user2439680 Jun 30 '14 at 06:15

1 Answers1

0

First you should create a folder structure like this:

+-- root (pom.xml)
     +--- mod-war (pom.xml)
     +--- mod-ear (pom.xml)

Add the mod-war as a dependency to the mod-ear. Make the packging of mod-war war whereas the packaging of mod-ear ear.

Apart from that follow the default folder layout structure instead of changing it cause it's not neccessary.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235