Maven
Build Commands
Compile, test, and package Java projects with Maven's build lifecycle. Understand lifecycle phases, skip options, and multi-module builds for efficient project compilation.
11 commands
Pro Tips
Use 'mvn package -DskipTests' to build without running tests — useful for quick iteration.
Use 'mvn clean install' to build and install the artifact to your local .m2 repository.
Build a specific module in a multi-module project: 'mvn -pl module-name -am package' (-am builds dependencies).
Common Mistakes
Don't skip tests in CI. Use '-DskipTests' only locally for faster feedback during development.
'mvn clean' deletes the entire target/ directory. Make sure no important generated files are stored there.