mvn

mvn

TLDR

Compile a project

$ mvn compile
copy

Compile and package the compiled code in its distributable format, such as a jar

$ mvn package
copy

Compile and package, skipping unit tests

$ mvn package -Dmaven.test.skip=true
copy

Install the built package in local maven repository. (This will invoke the compile and package commands too)

$ mvn install
copy

Delete build artifacts from the target directory

$ mvn clean
copy

Do a clean and then invoke the package phase

$ mvn clean package
copy

Clean and then package the code with a given build profile

$ mvn clean -P[profile] package
copy

Run a class with a main method

$ mvn exec:java -Dexec.mainClass="[com.example.Main]" -Dexec.args="[arg1 arg2]"
copy

Copied to clipboard
free 100$ digital ocean credit