Build with Maven

Building the project and running tests with Maven.

To build the project and run tests with Maven, open the command line, navigate to your project’s root directory and execute the following command:

mvn clean install

Since Maven expects a restrictive directory structure to projects, tests are located in src/test/java rather than src/main/java. Therefore, the goal test-compile must be executed, which will only compile classes from the test folder.

In case you not only want to compile but also execute the test then you can run mvn clean test which will implicitly run test-compile and executes them.

Grouping tests

You can also group your tests and execute only a subset of them with maven by following this guide for JUnit4 and this guide for JUnit5.

In JUnit4 you don’t need to define suite classes to group tests. Grouping can be done by annotate a class with one or more group-classes. Furthermore, you don’t need the @RunWith(Categories.class) this is already covered by NeodymiumRunner and must be configured via pom.xml, see Using categories with Maven. Thus executing test groups is currently only available via maven commands.

Last modified February 18, 2026: remove numbers from filenames (27bdd4a5)