Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to maven build child projects?

I have aggregation where I link a parent Pom using the <modules> element, and then I have the <parent> specified in each child pom.

Is there a way I can build only a subset of the child modules from the parent pom... i.e.

cd parent-dir
mvn install subproj1 subproj2
like image 444
Nicholas DiPiazza Avatar asked Nov 26 '12 15:11

Nicholas DiPiazza


People also ask

How does Maven build a project?

Maven will start building the project. We give maven two goals, first to clean the target directory (clean) and then package the project build output as jar (package). Packaged jar is available in consumerBanking\target folder as consumerBanking-1.0-SNAPSHOT.

Can a Maven project have multiple POM files?

Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.

How do I run a multi-module project in Maven?

A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.

What is parent project in Maven?

This POM is the common parent of all of the Maven components in the Apache Maven project. Most of its contents are pinning down version numbers of plugins. It does provide minimal dependencyManagement for plexus-component and plugin-tools annotations.


1 Answers

You can run Maven like this: mvn install -pl subproj1,subproj2

PS: another good Maven command to try: mvn -?

like image 165
Eugene Kuleshov Avatar answered Oct 03 '22 17:10

Eugene Kuleshov