I have a multi-module maven project and looking to leverage the parallel build feature in Maven 3. But some of the modules lay the groundwork for future modules (when built sequentially, like creating some directories, downloading some non-maven jars etc). Is there a way for me to control the parallelism partially so that the build starts of sequentially and then goes parallel and eventually converge to a final module that does aggregation and cannot be run before the others?
Thanks in advance
Just add a dependency on the pom (pom) we use this to order our docker builds (images depend on base images that need to built earlier)
I haven't tested this, but I think it should be possible. The downside is you will have to control that branch/join logic yourself by running mvn
multiple times.
First, check out this article for how to do parallel builds: https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3
Now when it comes to building individual modules, you should use this command line option:
-pl,--projects <arg> Comma-delimited list of specified
reactor projects to build instead
of all projects. A project can be
specified by [groupId]:artifactId
or by its relative path.
I think you will need to run the mvn
command multiple times. Let me know if you need more info.
Side Note: Consider this line
This build-mode analyzes your project's dependency graph and schedules modules that can be built in parallel according to the dependency graph of your project.
You may not need to do any branch/join logic. See if it works without it.
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