$ command-helper

Maven (mvn)

Build lifecycle, running single tests, skipping tests, dependency tree, multi-module builds and the wrapper.

Requires Google sign-in

Build

Clean build with tests
./mvnw clean verify

Use ./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 -DskipTests
Install to the local repository (~/.m2)
./mvnw install
Offline build (no downloads)
./mvnw -o package
Parallel build, 1 thread per CPU coreadvanced
./mvnw -T 1C clean install

Tests

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 -DskipTests
Skip compiling tests too
./mvnw package -Dmaven.test.skip=true

Dependencies

Dependency tree
./mvnw dependency:tree
Who brings in a libraryadvanced
./mvnw dependency:tree -Dincludes=<group_id>:<artifact_id>
Newer dependency versions
./mvnw versions:display-dependency-updates
Force re-download of snapshots
./mvnw -U clean install

Multi-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-pom
Run a Spring Boot app
./mvnw spring-boot:run
Debug outputadvanced
./mvnw -X package