0% found this document useful (0 votes)
14 views8 pages

Multi-Module Maven Project Overview

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views8 pages

Multi-Module Maven Project Overview

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Apache Maven

Beginner to Guru

Multi-Module Maven Projects


Overview of Multi-Module Projects
Module 1
Packaging = JAR

Parent Module 2
Packaging = POM Packaging = JAR
Module 3.1
Module 3 Packaging = JAR
Packaging = POM
Module 3.2
Packaging = JAR
Multiple Modules in Maven
• Important to remember each module is effectively a Maven project
• Just happens to inherit from its parent module
• Much like the ‘effective’ POM

• Each module can have child modules


• Important for organization on larger projects
Maven Reactor
• Known simply as ‘The Reactor’
• The Reactor is the what builds each module of the Maven project
• The Reactor collects the modules to build

• The Reactor will then run selected build lifecycle against each module
• The Reactor will determine the build order of the modules
• By default The Reactor will build modules sequentially
• Optionally can use threads to build modules in parallel
Reactor Build Order
• Factors determining the build order used by Reactor:
• Project dependencies - modules used by other modules in the project will get built first
• Plugin declaration - ie if module is a plugin used by other modules

• Order of modules declared in ‘modules’ section of POM


Multi-Module Code Smells
• Try to use modules only when needed
• Do not over-use modules
• Multiple modules will slow down your build

• Code Smells with Modules:


• One class or interface in a module
• Many small modules which could be combined
• “Someone might need…”
Apache Maven
Beginner to Guru

You might also like