user373201
user373201

Reputation: 11455

maven force rebuild of dependent projects (build dependencies first)

I have a multimodule maven project. the service module depends on domain module using dependency tag. Every time i build the service module, i want it to automatically build the domain module and pick up the most recent domain module from local repository. How can I do it. Right now it pick from the local repository but that may not be the latest copy.

I build the project from my service module dir and not from the parent directory. Because my parent module has lot of other submodules that I am not interested in building.

Upvotes: 17

Views: 17296

Answers (1)

Raghuram
Raghuram

Reputation: 52665

One thing you can possibly do is to build the service module from the parent directory with the following parameters.

mvn compile -pl service-module -am

What this does is builds only the service module, along with its dependant modules (which would include the domain module).

The options are described by mvn --help (Maven 2.2.0):

   -am,--also-make
          If project list is specified, also build projects required by the list

   -pl,--projects <arg>
          Build specified reactor projects instead of all projects

Upvotes: 18

Related Questions