Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:13:39+00:00 2026-06-10T03:13:39+00:00

I’ve been following the example on the maven-ear-plugin site that shows how to add

  • 0

I’ve been following the example on the maven-ear-plugin site that shows how to add third-party libraries to the generated application.xml. However, it does not appear to be working as I expected. Similarly the web module contextRoot is being ignored.

According to the documentation what I am trying to do should be entirely possible.

The context root of a Web module might be customized using the
contextRoot parameter.

Please note that third party libraries (i.e. JarModule) are not
included in the generated application.xml (only ejb-client should be
included in a java entry). However, a jar dependency could be included
in the generated application.xml by specifying the
includeInApplicationXml flag
.

I have the following output when it executes the build in my application.xml.

<?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>MyApp.EAR</display-name>
  <module>
    <ejb>MyApp.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>MyApp.war</web-uri>
      <context-root>/MyApp.Web</context-root>
    </web>
  </module>
</application>

From the following maven configuraton (pom.xml).

...
<modelVersion>4.0.0</modelVersion>
<groupId>com.blah</groupId>
<artifactId>MyApp.EAR</artifactId>
<version>1.0</version>
<packaging>ear</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>maven-ear-plugin</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <applicationName>MyApp</applicationName>
                <modules>
                    <ejbModule>
                        <groupId>com.blah</groupId>
                        <artifactId>MyApp.EJB</artifactId>
                    </ejbModule>
                    <webModule>
                        <groupId>com.blah</groupId>
                        <artifactId>MyApp.Web</artifactId>
                        <contextRoot>MyApp</contextRoot>
                    </webModule>
                    <jarModule>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-simple</artifactId>
                        <includeLibInApplicationXml>true</includeLibInApplicationXml>
                    </jarModule>
                </modules>
                <archive>
                    <manifestEntries>
                        <WebLogic-Application-Version>${weblogic.version}</WebLogic-Application-Version>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- web and ejb modules -->
    <dependency>
        <groupId>com.blah</groupId>
        <artifactId>MyApp.EJB</artifactId>
        <version>1.0</version>
        <type>ejb</type>
    </dependency>
    <dependency>
        <groupId>com.blah</groupId>
        <artifactId>MyApp.Web</artifactId>
        <version>1.0</version>
        <type>war</type>
    </dependency>
</dependencies>
...

It is immediately obvious that the application.xml is not being generated as I intended.

  1. The contextRoot supplied is not correct in the application.xml, instead the default name of MyApp.Web is output instead of the specified MyApp.
  2. The org.slf4j jarModule specified is missing entirely from the application.xml.

What am I doing wrong?

Debug from Maven is shown below.

[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-ear-plugin:2.4.2:generate-application-xml (default-generate-application-xml)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <description>${project.description}</description>
  <displayName>${project.artifactId}</displayName>
  <encoding default-value="UTF-8"/>
  <generatedDescriptorLocation>${project.build.directory}</generatedDescriptorLocation>
  <includeLibInApplicationXml default-value="false"/>
  <project>${project}</project>
  <version default-value="1.3"/>
  <workDirectory>${project.build.directory}/${project.build.finalName}</workDirectory>
</configuration>

P.S. I tried creating the maven-ear-plugin tag, but it would not let me as I am not reputable enough! If someone could create that I would be grateful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:13:41+00:00Added an answer on June 10, 2026 at 3:13 am

    I worked it out, as per usual, it was user error.

    Strangely it was producing the EAR file pretty much correctly, even though my plugin wasn’t configured properly.

    I replaced…

    <groupId>maven-ear-plugin</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    

    with…

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    

    Then changed…

    <includeLibInApplicationXml>true</includeLibInApplicationXml>
    

    to…

    <includeInApplicationXml>true</includeInApplicationXml>
    

    Then suddenly it did what I intended it to do in the first place.

    My final pom.xml looked like this as I decided I wanted all jar’s to be included automatically.

    <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.blah</groupId>
        <artifactId>MyApp.EAR</artifactId>
        <version>1.0</version>
        <packaging>ear</packaging>
    
        <properties>
            <weblogic.version>10.3</weblogic.version>
            <weblogic.version.minor>${weblogic.version}.4</weblogic.version.minor>
            <weblogic.host>***</weblogic.host>
            <weblogic.port>***</weblogic.port>
            <weblogic.username>***</weblogic.username>
            <weblogic.password>***</weblogic.password>
        </properties>
    
        <build>
            <finalName>MyApp</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ear-plugin</artifactId>
                    <version>2.7</version>
                    <configuration>
                        <applicationName>MyApp</applicationName>
              <includeLibInApplicationXml>true</includeLibInApplicationXml>
                        <modules>
                            <ejbModule>
                                <groupId>com.blah</groupId>
                                <artifactId>MyApp.EJB</artifactId>
                            </ejbModule>
                            <webModule>
                                <groupId>com.blah</groupId>
                                <artifactId>MyApp.Web</artifactId>
                                <contextRoot>MyApp</contextRoot>
                            </webModule>
                        </modules>
                        <archive>
                            <manifestEntries>
                                <WebLogic-Application-Version>${weblogic.version}</WebLogic-Application-Version>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>com.oracle.weblogic</groupId>
                    <artifactId>weblogic-maven-plugin</artifactId>
                    <version>10.3.4</version>
                    <configuration>
                        <adminurl>t3://${weblogic.host}:${weblogic.port}</adminurl>
                        <user>${weblogic.username}</user>
                        <password>${weblogic.password}</password>
                        <upload>true</upload>
                        <action>deploy</action>
                        <remote>false</remote>
                        <verbose>true</verbose>
                        <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
                        <name>${project.build.finalName}</name>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
    
            <pluginManagement>
                <plugins>
                    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.apache.maven.plugins</groupId>
                                            <artifactId>maven-ear-plugin</artifactId>
                                            <versionRange>[2.7,)</versionRange>
                                            <goals>
                                                <goal>generate-application-xml</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore></ignore>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    
        <dependencies>
        <dependency>
          <groupId>com.blah</groupId>
          <artifactId>MyApp.EJB</artifactId>
          <version>1.0</version>
          <type>ejb</type>
        </dependency>
        <dependency>
          <groupId>com.blah</groupId>
          <artifactId>MyApp.Web</artifactId>
          <version>1.0</version>
          <type>war</type>
        </dependency>
        </dependencies>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.