maven

dependency management tool for Java applications

mvn commands

export JAVA_HOME= jh

clean deleting the target directory.
compiler:compile compiles the java source classes
compiler:testCompile compiles the test classes
package builds the project and packages them into a JAR, WAR, etc.
installbuilds the project and installs the project files (JAR, WAR, pom.xml, etc) to the local repository.
deploy to the remote repository, configured in the project pom.xml distributionManagement tag.
The server entries in the maven settings.xml is used to provide authentication details.
validate
dependency:tree generates the dependency tree
dependency:analyze identify the unused declared and used undeclared dependencies.
Useful in reducing the build size by identifying the unused dependencies and then remove them from pom.xm .
$ mvn dependency:analyze
...
[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) @ Mockito-Examples ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.junit.jupiter:junit-jupiter-api:jar:5.2.0:test
[WARNING]    org.mockito:mockito-core:jar:2.19.0:test
[WARNING] Unused declared dependencies found:
[WARNING]    org.junit.platform:junit-platform-runner:jar:1.2.0:test
[WARNING]    org.junit.jupiter:junit-jupiter-engine:jar:5.2.0:test
[WARNING]    org.mockito:mockito-junit-jupiter:jar:2.19.0:test
...
archetype:generate templating toolkit. maven site, etc. Creating a Java Project using Maven Archetypes
site:site generates a site directory in the target .
MUltiple HTML files.
test run the test cases using the maven-surefire-plugin.
compile
verify builds the project, runs test cases and checks on the results of the integration tests

options

-help usage: mvn [options] [goal(s)] [phase(s)]
Options:
-am, --also-make             If project list is specified, also build projects required by the list
-amd,--also-make-dependents  If project list is specified, also build projects that depend on projects on the list
-B,--batch-mode              Run in non-interactive (batch) mode (disables output color)
-b, --builder           The id of the build strategy to use
-C,--strict-checksums       Fail the build if checksums don't match
-C,--lax-checksums
-cpu,--check-plugin-updates Warn if checksums don't match Ineffective, for backward compatibility

-f maven-example-jar/pom.xml package build a project from a different location.
-o package offline. JARs are in the local repository and don’t look in the remote repository.
-q package quite. test cases results and errors are displayed.
-X package Output version and runs the build in the debug mode.
enables debug messages .
-v
digitalocean.com/community/tutorials/maven-commands-options-cheat-sheet