Maven JXR issue

Finally got some time to have a look at one of my old CI machines with Jenkins which has failing jobs. Some of these were failing due to the lack of space. It’s pretty easy to fix since it’s a Linux AMI on Amazon. Just create a new EBS, mount it to the needed point and move some data. Wuala, the problem is fixed.

However another problem I got was from Maven. The command we run looks like: mvn clean install site

The error seems to be pretty strange:
Embedded error: Error rendering Maven report: Error while generating the HTML source code of the projet.
basedir /data/Sources/workspace/Statistics/service/target/generated-sources/groovy-stubs/main does not exist

Running things with -X flag shows the origin of the problem:
Caused by: java.lang.IllegalStateException: basedir /data/Sources/workspace/service/target/generated-sources/groovy-stubs/main does not exist
    at org.codehaus.plexus.util.DirectoryScanner.scan(
    at org.apache.maven.jxr.pacman.PackageManager.parse(
    at org.apache.maven.jxr.pacman.PackageManager.process(
    at org.apache.maven.jxr.JXR.xref(
After a bit of investigation I found filled by me 🙂 It appears that I already provided a patch for this problem. However it looks like it was ignored.

The issue happens in case of the following project structure:
    |- main
        |- java
    |- test
        |- groovy
        |- java

So you’ll get this kind of build failures in case if you have Groovy tests but do not have any Groovy files in the production code.

There’s a pretty simple workaround since applying patch to the plugin might be a bit difficult to spread across environments. You can create some dummy file like src/main/groovy/PlaceHolder.groovy with the simple contents:

println “Placeholder for JXR-95”

It will be enough to bypass the problem.