Common problems when building JSPWiki

Common problems when building JSPWiki#

Error MDEP-98 at jspwiki-portable with mvn clean compile or mvn clean test#

TLDR: build the project with at least mvn package

When mvn clean compile or mvn clean test from the parent pom, the build fails at the jspwiki-portable module with the following stacktrace:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:unpack
(unpack-jspwiki-war) on project jspwiki-portable: Artifact has not been packaged yet. When used 
on reactor artifact, unpack should be executed after packaging: see MDEP-98. -> [Help 1]

Due to Maven way of resolving dependencies on multimodule builds, dependencies are usually resolved from your maven repo, except for those dependencies which happen to be part of the reactor (in Maven world, the reactor is the concrete execution of a build, which is made up of the modules which take part on it). The reasoning behind that is that reactor dependencies are supposed to be "fresher" than anything present on the local m2 repo.

The jspwiki-portable module tries to unpack the jspwiki-war module so, when doing the whole build, it tries to resolve the dependency from the reactor instead of from the local maven repo, thus the build will fail with anything less than mvn package. OTOH, having done a whole mvn install, and then mvn test or mvn compile from jspwiki-portable, it will succeed: this time the reactor will be made up of one module (jspwiki-portable), so when trying to unpack jspwiki-war, Maven will resolve the dependency from the local maven repo.

jspwiki-main:jar:tests:X.Y.Z not found at jspwiki-markdown#

TLDR: skip tests execution using -DskipTests flag instead of -Dmaven.test.skip

While executing the build using the -Dmaven.test.skip flag to skip tests execution, the build fails at jspwiki-markdown module with the following stacktrace:
[ERROR] Failed to execute goal on project jspwiki-markdown: Could not resolve dependencies for project
org.apache.jspwiki:jspwiki-markdown:jar:X.Y.Z-SNAPSHOT: Failure to find org.apache.jspwiki:jspwiki-main:jar:tests:X.Y.Z-SNAPSHOT 
in https://repository.apache.org/snapshots <https://repository.apache.org/snapshots> was cached in the local repository, resolution 
will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced -> [Help 1]

jspwiki-main produces (at least) two artifacts, the "main" artifact, jspwiki-main-X.Y.Z.jar, and the "tests" artifacts, jspwiki-main-X.Y.Z-tests.jar. The latter contains TestEngine and associated classes, that may be come handy for testing (your) third party extensions, and is generated from compiled test sources of jspwiki-main. Using the -Dmaven.test.skip flag does not only skips tests execution, but tests compilation as well, so it prevents the generation of the jspwiki-main-X.Y.Z-tests.jar artifact, which is needed later on the build, to run the jspwiki-markdown module associated tests.

To skip tests execution, the -DskipTests flag should be used instead.