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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:31:29+00:00 2026-05-31T05:31:29+00:00

I posted a question last week on how i can build dependent modules and

  • 0

I posted a question last week on how i can build dependent modules and the result was that it was recommended that i use a build tool like Maven or Ivy. I decided to use Maven to try and achieve what i would like to do. My project basically builds a single war file which is deployed to Tomcat. The modules themselves are part of the final war file. Here is an example structure of the modules

Module 1

customerModule
    |-webapp
        |-jsp
            |-customer
                |-findCustomer.jsp
                |-addNewCustomer.jsp
                |-deleteCustomer.jsp
    |-src
        |-com
            |-mycompany
                |-customer
                    |-FindCustomerAction.java
                    |-AddCustomerAction.java
                    |-DeleteCustomer.java

Module2

productModule
    |-webapp
        |-jsp
            |-product
                |-productCustomer.jsp
                |-addNewProduct.jsp
                |-deleteProduct.jsp
    |-src
        |-com
            |-mycompany
                |-product               
                    |-FindProductAction.java
                    |-AddProductAction.java
                    |-DeleteProduct.java            

Module3

commonModule
    |-webapp
        |-css
            |-style.css
        |-jsp
            |-templates
                |-coreTemplate.jsp
    |-src
        com
            |-mycomany
                |-common
                    |-Logger.java
                    |-Access.java
    |-META-INF
        |-MANIFEST.MF
        |-context.xml
    |-WEB-INF
        |-lib
            |-oraclejdbc.lib
            |-log4j.lib
            |-common.lib
        |-struts-config.xml
        |-tiles-def.xml
        |-web.xml

As you can probably see, the above will all collectively form one application. What i would like to do is to end up with an artifact for each module. Because of the mixture of file types(jsp,css,java) i am not quite sure what is a suitable artifact. The diagram below show the structure of the war file i would like to end up with.

MyApp.war
    |-webapp
        |-css
            |-style.css
        |-jsp
            |-customer
                |-findCustomer.jsp
                |-addNewCustomer.jsp
                |-deleteCustomer.jsp
            |-product
                |-productCustomer.jsp
                |-addNewProduct.jsp
                |-deleteProduct.jsp     
            |-templates
                |-coreTemplate.jsp
    |-META-INF
        |-MANIFEST.MF
        |-context.xml
    |-WEB-INF
        |-lib
            |-oraclejdbc.lib
            |-log4j.lib
            |-common.lib
            |-customerModule.jar
            |-productModule.jar
        |-classes
            |-com
                |-mycomany
                    |-common
                        |-Logger.class
                        |-Access.class
        |-struts-config.xml
        |-tiles-def.xml
        |-web.xml   

A couple of notes
– The java files in commonModule are built and end up in WEB-INF/classes
– The java files for the customerModule end up as a jar file in WEB-INF/lib
– The java files for the productModule end up as a jar file in WEB-INF/lib
– All of the jsps,css end up in the root of the war file

What is the best way i should store the artifact for each module in the repository?

  • I could use a jar file but this cant hold the html type files(jsp,css,js etc)
  • Each module (except the commonModule) will contain a jar file + the jsp, css files. I am thinking of storing the built artifact as a zip file and extract it when the MyApp.war is built to build the war file?
  • Can i store the artifact for each module as a war file even though only one has a web.xml file?

How can i implement this using Maven

  • I have been investigating Maven and found that it might be possible to have a multi module project with the following structure

    MyApp.pom (parent project)
    commonModule.pom
    customer.pom
    product.pom

  • If i zipped up the modules in the repository how would i refer to them from the parent project and unzip them to build the final war file?

  • Is it possible to automatically trigger the build of the parent project if any of the child projects are built?
  • I havent figured out how to maintain the version of each of the child projects. If i build the customer project, how does the parent project know that there is a newer version of the customer.zip (or .jar) in the repository?
  • Assuming the repository currently contains the following

    |-productModule.v.0.1.zip

    |-customerModule.v.0.1.zip

    |-commonModule.v.0.1.zip

If i rebuild, the customerModule and then rebuild the war file buy building the parent project, does maven rebuild all of the other modules in the repository even if they have not changed? How exactly will this work?

Is there an example project anywhere that demonstrate how to achieve the above? Any links or resources which show an example of the above would be very useful.

  • 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-31T05:31:30+00:00Added an answer on May 31, 2026 at 5:31 am

    First your structure looks wrong, cause the default folder layout for a war project looks like:

      +-- pom.xml (war packaging)
      +-- src/main/java (java Sources)
      +-- src/main/webapp (jsp pages etc.)
      +-- src/main/resources (language bundles etc.)
    

    Furthermore if you like to end up with all modules into a same war file but you would like to separate those given modules. The best way is to create a multi-module build which looks like:

      root
      +-- pom.xml (parent of all)
      +-- mod-war (incl. pom.xml)
      +-- mod-1 (incl. pom.xml)
      +-- mod-2 (incl. pom.xml)
    

    and make dependencies to mod-1 and mod-2 in the mod-war pom. this will result in having them be packaged into a single war file which contains separate mod-1-VERSION.jar etc. This artifact (war file) can be deployed to an appropriate repository which itself can be used as an dependency if needed.

    You can take a look here as an example.

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

Sidebar

Related Questions

I posted this question last week, but I wasn't very clear on what was
This is a followup question to the one I posted last week Ajax.ActionLink not
I posted a question here last week about using Ajax with J2EE and got
I posted a question last night about Java Reflection and am discovering compiler warnings
Following a question posted here about how I can increase the speed on one
I recently posted a question about getting last 3 results in table in the
This is somewhat of a follow up to a question posted earlier last month.
I vaguely learned how regex work earlier on my last question and thought that
I posted a question last night, but unfortunately I was not specific enough vis
I already posted a question about this ( Abandoned instances that will not continue

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.