user1137387
user1137387

Reputation: 2043

Maven for multiple modules

How do I run selected modules using parent pom in Maven like I have

<module>APP_1</module>
<module>web_1</module>
<module>service_1</module>
<module>schema_1</module>

<module>APP_2</module>
<module>web_2</module>
<module>service_2</module>
<<module>schema_2</module>

sometimes as developer if I want to build first module only so how should I achieve this task in parent pom?

Upvotes: 2

Views: 3544

Answers (2)

Dave
Dave

Reputation: 21924

First you have to make a decision.

Assuming that some of your child modules depend on other child modules you have to decide if you want to:

a) build one or more modules by themselves using the last built version of the dependent modules located in your ~/.m2/repository directory. This is super useful if you want to, say, rebuild the web_2 module which depends on the service_2 module, but service_2 is currently busted and won't compile. In this case do this:

mvn clean install --projects module-directory-name

or

b) you want to build a module and have maven recursively check all dependent modules to see if they need to be rebuilt. This is slower and safer typically. This command is:

mvn reactor:make -Dmake.artifacts=com.yourgroup:module-name

I use both of these at different times every day.

Upvotes: 2

maximdim
maximdim

Reputation: 8169

mvn reactor:make -Dmake.folders=barBusinessLogic

as described here

Upvotes: 1

Related Questions