Maven Tips Link
https://dzone.com/articles/5-maven-tips
https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
https://zeroturnaround.com/rebellabs/maven-cheat-sheet/
Helpful Maven Build Commands
- Resume Build
mvn -rf <module-name> clean install - Parallel Builds
mvn -T <no. of Threads> install
mvn -T <no. of CPU Cores>C install - Build Selective Modules
mvn -pl <module-name1>,<module-name2> clean install - Build Selective Module and its dependencies
mvn install -pl <module-name> -am - Build Selective Module and its dependents
mvn install -pl <module-name> -amd - Build Selective Module and its dependents at the same time exclude a dependent
mvn install -pl <module-name>,!<dep-module-name> -amd
Few Skip Activities to Improve Build productivity in Maven
- Skip Unit Test
mvn install -Dmaven.test.skip=true - Skip FindBugs Analysis
mvn install -Dfindbugs.skip=true - Skip Online Build (Offline build)
mvn -o install - Skip Cleaning, only package or install
- Skip Unrequired Modules - By building selective modules.
- Skip Assembly (moving packages and other simple assemblies), If required.
Helpful Maven Analysis Commands
- Generate Dependency Tree - Finding the Dependencies
mvn dependency:tree - Generate Dependency Tree of a particular Module in MultiModule Project - Finding the Dependents
mvn dependency:tree -Dincludes=<group-id>:<artifact:id>
example:
mvn -o dependency:tree -Dincludes=com.wildcraft:app -DappendOutput=true -DoutputType=dot -DoutputFile=C:/dependencyTree.dot - Filter includes with LIKE option with * - Filtering the Dependents
mvn dependency:tree -Dincludes=<group-id partial name>.*
example:
mvn -o dependency:tree -Dincludes=com.aris.* -DoutputType=dot -DoutputFile=dependencyTree.dot
Combine dot format in GraphViz
While checking list of dependents of a Module, one might required to combine various digraphs generated by maven with command - mvn -o dependency:tree -Dincludes=<module-name> -DappendOutput=true -DoutputType=dot -DoutputFile=<filepath>
GraphViz tool can be used to combine these multiple graphs with example command as below.
C:\Softwares\graphviz-2.38\bin>type C:\dependencyTree.dot | gvpack -u -o output.dot
Output file will be available at C:\Softwares\graphviz-2.38\bin