Example example_maven_test-blackbox

Part of the full Java 9 Jigsaw modules example suite.

Authors

Migrated for Java Modules support documentation of Apache MavenTM in the course of the Maven Support & Care program by Gerd Aschemann (and other team members) as forked repository. Please add discussions, requirements, bugfixes, etc. to the fork instead of the original.

What is this example about?

Modules in this example

  • modmain plus module org.apache.commons.lang3

  • modmain has a Main class which is started in run.sh

Example shows …​

  • Compilation, test compilation and execution with Maven

  • Blackbox test with own module-info.java in src/test/java

The maven compile and surefire plugins recognize the test classes as an own module here, because there is a module-info.java

Note: No JavaDoc generation for this example

Setup

You might want to edit the Maven settings file mvn_settings.xml according to your needs (proxies, local repository path etc.) The file provided here is just a copy of the original file from Maven 3.5.2 distribution.

Maven plugins

  • maven-compiler-plugin Version >= 3.6.1 is needed

  • The current surefire-plugin does not yet support modules. It runs tests in classpath mode.

Output and Testing

This example does not use golden master testing because Maven output includes timestamps, absolute file paths, and version information that varies between runs. See the golden master testing section in the main README for more information.