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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:40:37+00:00 2026-06-17T00:40:37+00:00

I have a project with three levels of modules. Let’s suppose it has the

  • 0

I have a project with three levels of modules. Let’s suppose it has the following organization …

+-- maven-root
   +-- maven-module-1
   |   +-- maven-submodule-1-1
   |   +-- maven-submodule-1-2
   +-- maven-module-2
   |   +-- maven-submodule-2-1
   |   +-- maven-submodule-2-2
   +-- maven-module-3
       +-- maven-submodule-3-1
       +-- maven-submodule-3-2

Additionally, we have the following set of dependencies

  • maven-module-2 depends upon maven-module-1
  • maven-module-3 depends upon maven-module-3

In this structure, and supposing artifacts for maven-module-1 and its submodules are already available in local repository, is there a solution using maven reactor (as an example) to build only maven-module-2 and its submodules ?

I already know that, using maven reactor, if I do

mvn clean install -pl :maven-module-2 --also-make-dependant

It will build

  1. maven-module-2
  2. maven-submodule-2-1
  3. maven-submodule-2-2
  4. maven-module-3
  5. maven-submodule-3-1
  6. maven-submodule-3-2

as maven-module-3 have a dependency upon maven-module-2

And obviously, running

mvn clean install -pl :maven-module-2 --also-make

will only build maven-module-1 and maven-module-2.

So, how, using that project organization, can I build only maven-module-2 ?

  • 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-17T00:40:39+00:00Added an answer on June 17, 2026 at 12:40 am

    Using

    mvn clean install -f maven-module-2 -N
    

    will build only maven-module-2 and

    mvn clean install -f maven-module-2
    

    will build maven-module-2 and its children

    Take care that -f is used to say to Maven to use another POM (or module directory and it takes the pom.xml in it) than the one in the current directory. Thus unlike -pl where maven considers all modules in your project and then build only a subpart of them, -f only build what is referenced by this project/module/pom. To do

    mvn clean install -f maven-module-2
    

    is exactly like

    cd maven-module-2; mvn clean install
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a maven multi-modules project which has a depth of around 5 levels.
I have a multi-module maven project (several levels of nesting). Normally, when I execute
I have three modules in my Maven project (this is slightly simplified): model contains
I have a WAR Module in a multi-module Maven project (let's say foo-web), which
I have a project which has shared functionality between three other projects and have
In my project I have the following three interfaces, which are implemented by classes
I have a maven2 multi-module project and in each of my child modules I
I have multiple modules in an IntelliJ project where each module's dependencies are managed
I have a maven project of the form <project> <groupId>com.example.project</groupid> <artifactId>project</artifactId> <module>module1</module> <module>module2</module> <module>module3</module>
I have several projects open in an Eclipse workspace. Like so: com.harbl.project.one com.harbl.project.two com.harbl.project.three

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.