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 7612569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:56:46+00:00 2026-05-31T01:56:46+00:00

I read this question on SO – How to add WAR inside EAR with

  • 0

I read this question on SO – How to add WAR inside EAR with Maven

In top voted answer by “joelittlejohn” –

“Now create a parent module (with pom) and add
the war module and the ear module to it. Make sure you set the parent
of the war and ear modules corrently. When you run mvn
package for this new parent, a war file will be built by the war
module and an ear file (containing the war) will be built by the ear
module.”

But why create a parent pom ? Why not just created a standard maven project with just a single pom. This single pom file contains the dependencies & modules, then generate the .ear file from this one pom file ?

Something like :

<plugin>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <finalName>MyEarFile</finalName>
        <version>5</version>
        <generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation>
        <modules>
            <webModule>
                <groupId>com.your.group.id</groupId>
                <artifactId>your-war-artifact</artifactId>
                <uri>YouWarFile.war</uri>
                <bundleFileName>YouWarFile.war</bundleFileName>
                <contextRoot>/appname</contextRoot>
            </webModule>
        </modules>
    </configuration>

    <dependencies>
    <dependency>
    <groupId>com.your.group.id</groupId>
    <artifactId>your-war-artifact</artifactId>
    <version>your-war-version</version>
    <type>war</type>
    </dependency>
    </dependencies>

</plugin>
  • 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-05-31T01:56:48+00:00Added an answer on May 31, 2026 at 1:56 am

    It’s typical in maven to have a module for each war you want to build. And then the .ear file will contain multiple wars. So having a module each just provides a nice separation of duties. The parent pom just wraps it all together.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

N.B THIS QUESTION HAS BEEN UPDATED, READ FURTHER DOWN Hi, I want to create
I read this question and its answer in a book. But I didn't understand
I just read this question and the accepted answer: What is JavaScript garbage collection?
I have read this question , but I couldn't create a full example: class
I have read this question: How to create a file with a given size
I have read this question and I want to add to it that what
I read this question/answer however there wasn't any mention of it being a "bad
I have read this question and found its answer to be useful to check
I have read this question but it doesn't exactly answer my question. Unfortunately, it
I read this question but the answer does not perform a refactoring of the

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.