Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven force rebuild of dependent projects (build dependencies first)

Tags:

maven

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.

like image 818
user373201 Avatar asked Feb 08 '11 14:02

user373201


People also ask

How do I force Maven to reinstall dependencies?

In Maven, you can use Apache Maven Dependency Plugin, goal dependency:purge-local-repository to remove the project dependencies from the local repository, and re-download it again.

How do I force Maven to download dependencies from remote repository?

Force maven to fetch dependencies from the remote repository while building the project. We can use -U/--update-snapshots flag when building a maven project to force maven to download dependencies from the remote repository.

Does Maven clean remove dependencies?

It only cleans the project. Show activity on this post. Show activity on this post. With the help of Purging local repository dependencies you need to do that.


1 Answers

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
like image 106
Raghuram Avatar answered Sep 20 '22 21:09

Raghuram