To install Maven with DNF:

$ dnf install maven

To install Maven manually:

$ wget
$ tar xzvf apache-maven-3.6.1-bin.tar.gz
$ cd apache-maven-3.6.1/bin


Creating a Maven Project#

To create a Maven project:

$ mvn archetype:generate \
`` -DarchetypeArtifactId=maven-archetype-quickstart ``
`` -DinteractiveMode=false ``
`` -DgroupId=``com.example`` ``
`` -DartifactId=``app

It will create an app subfolder containing the following files:

  • pom.xml

  • src

    • main/java/com/example/app/

    • test/java/com/example/app/


        <version>(whatever version is current)</version>

Native Library#


See also Native Maven Plugin: Usage.


To setup Eclipse project:

$ mvn eclipse:clean
$ mvn eclipse:eclipse
$ mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

See also:


To install a JAR file into the local Maven repo:

$ mvn install:install-file \
   -Dfile=<path-to-file> \
   -DgroupId=<group-id> \
   -DartifactId=<artifact-id> \
   -Dversion=<version> \
   -Dpackaging=<packaging> \

For example:

$ mvn install:install-file \
   -Dfile=/usr/lib/java/jss4.jar \
   -DgroupId=org.mozilla \
   -DartifactId=jss \
   -Dversion=4.8.0-SNAPSHOT \
   -Dpackaging=jar \

To download dependencies:

$ mvn dependency:resolve

To display dependency tree:

$ mvn dependency:tree

To construct classpath:

$ mvn dependency:build-classpath

Building a Maven Project#

To build the classes:

$ mvn compile

The classes will be stored in target/classes folder.

To build the package:

$ mvn package

The package will be stored in target/–SNAPSHOT.jar.

To build the package without running tests:

$ mvn package -Dmaven.test.skip=true

To clean a Maven project:

$ mvn clean

Tomcat Plugin#

To install tomcat8-maven-plugin:


See also tomcat7-maven-plugin.