razzi.abuissa.net

Razzi's guide to maven

maven is a java build tool that is a bit less of a “product” than gradle.

install maven

sudo apt install maven

create a project

Run the following command:

mvn archetype:generate -DgroupId=example -DartifactId=example -DinteractiveMode=false

run the tests on your new project

$ cd example
$ mvn test

It configures and includes junit by default.

It’ll download the dependencies and run your tests. You should see:

example $ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< example:example >---------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.15
.0/maven-compiler-plugin-3.15.0.pom
<...>
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/common-junit3/3.5.4/common-junit3-3.5.4.jar (12 kB at 363 kB/s)
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running example.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 s -- in example.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.323 s
[INFO] Finished at: 2026-03-27T01:53:38-05:00
[INFO] ------------------------------------------------------------------------

see also

source code

https://github.com/apache/maven