Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between --also-make and --also-make-dependents

Tags:

maven

I recently learned about --also-make parameter that you can pass to Maven. From what I understand it causes that not only my-project will be build but also all projects dependent to my-project.

mvn --projects my-project --also-make install

But there is also another parameter called --also-make-dependents. From description it looks like it does the same thing as --also-make, but my friend at work told me that they are not the same thing. What is the difference?

like image 823
user7061317 Avatar asked Oct 23 '16 18:10

user7061317


People also ask

What are the build dependencies used in Maven?

There are two types of dependencies in Maven: direct and transitive. Direct dependencies are the ones that we explicitly include in the project. On the other hand, transitive dependencies are required by direct dependencies. Maven automatically includes required transitive dependencies in our project.

Can we have two pom XML?

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

What is Reactor build order in Maven?

Reactor Sorting a project dependency on another module in the build. a plugin declaration where the plugin is another module in the build. a plugin dependency on another module in the build. a build extension declaration on another module in the build.

How do you write a resume in Maven after failing?

With Maven 4, you can make your life even easier and use --resume , or -r for short. It will automatically resume the build from the module that last failed.


1 Answers

  • --also-make builds all projects that my-project depends on
  • --also-make-dependents builds all projects that depend on my-project

If you imagine DAG (Directed Acyclic Graph) of dependencies between projects (where edge A -> B means that B is dependent on A), then --also-make builds all projects from project my-project towards the "root" projects and --also-make-dependents builds all projects from project my-project towards the "leaf" projects.

Example

Let's say you have following projects:

 dao     util
   \     /
  services
     | 
   webapp

Then

mvn --projects services --also-make

will build dao, util and services. And

mvn --projects services --also-make-dependents

will build services and webapp

like image 94
mateuszlo Avatar answered Sep 28 '22 03:09

mateuszlo