28 February 2011

Maven 2.1 site command trouble

The maven site command allows you to generate project documentation, as explained in an earlier post for maven 2.0.

Running  mvn:site with Maven version 2.1, I had some problems however:

  1.  site plugin version error
    SiteToolException: ArtifactNotFoundException: The skin does not exist: Un able to determine the release version
    Apparently the skin plugin does not install automatically with a version, so force the issue, from the command line:
    $ svn checkout http://svn.apache.org/repos/asf/maven/skins/trunk/
    $ cd trunk
    $ mvn install -DupdateReleaseInfo=true
  2. doxia ArrayIndexOutOfBoundsException
    [WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink
    instance and no SinkFactory available. Please update this plugin.
    [INFO] ------------------------------------------------------------------------
    [ERROR] FATAL ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] 1
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    java.lang.ArrayIndexOutOfBoundsException: 1
            at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791) 
    This error is caused by some maven/module version mismatches.
    To solve this second issue, add a <pluginManagement> element under the build element to set compatible versions. <pluginManagement> has a <plugins> child element. Do not confuse this with the <plugins> child of the <buid> element.
    <project>
       ...
       <build>
         <pluginManagement>
             <plugins>
               <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
                 <version>2.1.1</version>
                 <dependencies>
                   <dependency>
                    <groupId>commons-httpclient</groupId>
                    <artifactId>commons-httpclient</artifactId>
                    <version>3.1</version>
                    <exclusions>
                     <exclusion>
                       <groupId>commons-logging</groupId>
                       <artifactId>commons-logging</artifactId>
                     </exclusion>
                   </exclusions>
                 </dependency>
                </dependencies>
              </plugin>
            </plugins>
        </pluginManagement>
        ...
     </build>
      ...
    </project>
    
     This modification takes care of the exception, and your documentation generation will succeed. The [WARNING]s above, however, will remain.

17 February 2011