Maven (mvn)
Build lifecycle, running single tests, skipping tests, dependency tree, multi-module builds and the wrapper.
Build
Clean build with tests
./mvnw clean verifyUse ./mvnw (the project's wrapper) instead of a global mvn to get the same Maven version as CI.
Package without running tests
./mvnw clean package -DskipTestsInstall to the local repository (~/.m2)
./mvnw installOffline build (no downloads)
./mvnw -o packageParallel build, 1 thread per CPU coreadvanced
./mvnw -T 1C clean installTests
Run one test class
./mvnw test -Dtest=<test_class>
Run one test method
./mvnw test -Dtest=<test_class>#<test_method>
Compile tests but don't run them
./mvnw verify -DskipTestsSkip compiling tests too
./mvnw package -Dmaven.test.skip=trueDependencies
Dependency tree
./mvnw dependency:treeWho brings in a libraryadvanced
./mvnw dependency:tree -Dincludes=<group_id>:<artifact_id>
Newer dependency versions
./mvnw versions:display-dependency-updatesForce re-download of snapshots
./mvnw -U clean installMulti-module and debugging
Build one module and what it depends onadvanced
./mvnw -pl <subproject> -am package
Effective POM (all inherited settings)advanced
./mvnw help:effective-pomRun a Spring Boot app
./mvnw spring-boot:runDebug outputadvanced
./mvnw -X package