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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:49:47+00:00 2026-05-17T14:49:47+00:00

I have a multi-module Maven project with a parent project P and three sub-modules

  • 0

I have a multi-module Maven project with a parent project P and three sub-modules A, B, and C. Both B and C are war projects and both depend on A.

I can type mvn compile in P and have all of the sub-modules properly compiled. The problem comes when I want to do operations for specific modules.

I’d like to be able to package a war for project B, but when I run the package command from B‘s directory, it complains that it can’t find the dependencies for A.

I understand from this question: Maven and dependent modules that perhaps Maven isn’t really designed for this type of dependency resolution, but that begs the question of how do I package B?

  1. Do I have to run mvn package for the entire project hierarchy when I really just want B?

  2. Do I have to install snapshots of A into my local repository every time I want to package B?

This second scenario isn’t much fun when A is still under active development.

Any best practices here?

  • 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-17T14:49:47+00:00Added an answer on May 17, 2026 at 2:49 pm

    Any best practices here?

    Use the Maven advanced reactor options, more specifically:

    -pl, --projects
            Build specified reactor projects instead of all projects
    -am, --also-make
            If project list is specified, also build projects required by the list
    

    So just cd into the parent P directory and run:

    mvn install -pl B -am
    

    And this will build B and the modules required by B.

    Note that you need to use a colon if you are referencing an artifactId which differs from the directory name:

    mvn install -pl :B -am
    

    As described here:

    • Define modules list which shall be build in Maven multiproject build
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-module maven project made up of three sub-modules: web , service
I have a multi module Maven project and I want the sub projects to
Using maven 3.0.4 I have a multi-module maven project, with some modules producing war
I have a Maven multi-module project and I need two different parent POMs in
I have Maven multi-module project with such structure: parent-pom-project -- module1 -- module2 At
My usual practice is to have a single maven project (can be multi-module) per
I have a multi-module Maven project A. There are two modules: B and C,
I have a multi-module Maven project that makes use of WAR overlays (stack of
I have a multi-module maven project with an installer sub-project. The installer will be
I have a multi-module maven project. We intend to version all these modules together.

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.