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

  • Home
  • SEARCH
  • 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 7565695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:13:15+00:00 2026-05-30T14:13:15+00:00

Our current working Maven structure builds one EAR and is as below workspace >parent

  • 0

Our current working Maven structure builds one EAR and is as below

workspace

>parent proj (containing root pom.xml)
    >ear proj
    >web proj
    >jar1
    >jar2
    >jarN

We now need to customize this such that we build multiple EARs (for different requirements) using a combination of jars.

So the suggested workspace will now look like this:

workspace

>parent proj (containing root pom.xml)

    >ear projects
        >ear1 
        >ear2
    >web projects
        >web1
        >web2

    >component jars
        >jar1
        >jar2
        >jarN

and in ear1 project pom.xml we want to pick and choose the web projects and jar projects which we need.

The question is:

a) is this above structure possible – since the folders named “ear projects”, “web projects”, “component jars” do not actually have a POM and build nothing

b) is is possible for an ear1 pom.xml to be built using artefacts outside of the same folder?

Earlier project ear1 was parallel with the jar1 and jar2 and all were child modules of the root pom.xml. But in the proposed structure, ear1 is built using the modules not in parallel, but ../web projects/web1 ../component jars/jar1 and so on.

c) is there a better way to achieve this?

  • 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-30T14:13:16+00:00Added an answer on May 30, 2026 at 2:13 pm

    The offered workspace looks good. For clarity, I’ll put it here (note, ear, web and components are all empty directories).

    parent (contains root pom.xml)
    |--- ear
         |--- ear1 (contains ear1 pom.xml)
         |--- ear2 (contains ear2 pom.xml)
    |--- web
         |--- web1 (contains web1 pom.xml)
         |--- web2 (contains web2 pom.xml)
    |--- components
         |--- jar1 (contains jar1 pom.xml)
         |--- jar2 (contains jar2 pom.xml)
         |--- jarN (contains jarN pom.xml)
    

    Since project dependencies are taken from repository (local or remote), there is no problem that modules aren’t going to be located on the same level. You should declare them as usual dependencies. For example, in ear1 you can specify:

    <dependencies>
      <dependency>
        <groupId>_your_groupId_</groupID>
        <artifactId>_jar1_artifactId_</artifactId>
        <version>_jar1_version_</version>
      <dependency>
      <dependency>
        <groupId>_your_groupId_</groupID>
        <artifactId>_web1_artifactId_</artifactId>
        <version>_web1_version_</version>
      <dependency>
    </dependencies>
    

    I’m not sure if I totally understand your needs, but I’ll try to describe what I would do.

    You can use profiles to specify which projects to build. For example, assume ear1 project depends on jar1, jar2, jar4 and web2 projects. In this case, in your root pom.xml file you can specify a profile like this:

    <profiles>
      <profile>
        <id>ear1</id>
        <modules>
          <module>components/jar1</module>
          <module>components/jar2</module>
          <module>components/jar4</module>
          <module>web/web2</module>
          <module>ear/ear1</module>
        </modules>
      </profile>
    </profiles>
    

    If you run mvn package -P ear1, then Maven will build only those modules that are specified in <modules> section of the profile.

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

Sidebar

Related Questions

So I'm working on a framework-esque system with one of my co-workers. Our current
I am a web developer working with 2-3 people including me. Our current setup
I'm working on a project that aims to replace our current PDF generator with
One of our current milestones on our (open source) project at the moment is
Our current project is made up of Python2.3 and wxPython-2.4.1.2. It is working fine.
Where i am working we have the following issue: Our current test procedure is
I'm currently looking into replacing our very proprietary build environment with Maven. The current
On the current project I'm working on, we have the following problem. Our software
Our current automated build consists of 1 master box and 4 core-2-duo pizza boxed
Our current product is based on Eclipse RCP. We are starting to have problems

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.