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?
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.
Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.
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.
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.
--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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With