Go to content

It works on my machine — Maven site plugin

Published on

Today I had a very strange case with the Maven site plugin using Maven 2.2. The site and the reports built fine on my machine but failed on several other machines. One of these was the server that hosts the documentation so I had to fix it. It failed with the message

[INFO] Trace java.lang.ArrayIndexOutOfBoundsException: 1 at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791) at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableHeaderCell(XhtmlSink.java:777)

The message was not very useful to me and there was no table in one of my documents so it would be hard to debug. From what I found on Google it may have to do with an outdated version of the Maven site plugin. I tried building the site with a clean local Maven repository to be sure that it wouldn’t take an exotic version of the plugin from the local repository. It still worked on my machine so maybe my machine did use the latest version while the others relied on a previous version.

Then I started reading the Plugin documentation (men never do that, you know) and found out that the maven-site-plugin was only configured in the reporting section of the pom and not in the build section. After adding the configuration to the build section of the pom it works on all machines.