Home‎ > ‎Maven‎ > ‎Plugins‎ > ‎

GitHub

Using the GitHub maven plugins to publish the site and/or Javadocs. 
Publishing Javadocs
Using the GitHub maven plugin to publish Javadocs to gh-pages.

1. Setting properties for the Javadocs and GitHub plugin.
<github.version>0.7</github.version>
<maven-javadoc-plugin.version>2.9</maven-javadoc-plugin.version>
2. Setup the Javadocs plugin. Aggregate a Maven multi-module project.
  • <maxmemory/> is the same as using <additionalJOptions/> with -J-Xmx1024m
  • Export JAVA_HOME to use with the javadocs like: export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
<!-- run 'mvn site' to output javadocs to gh-pages -->
<!-- run 'mvn javadoc:javadoc -X' to debug -->
<!-- http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html -->
<plugin>
   
<groupId>org.apache.maven.plugins</groupId>
   
<artifactId>maven-javadoc-plugin</artifactId>
   
<version>${maven-javadoc-plugin.version}</version>
   
<configuration>
       
<!-- same as  <additionalJOption>-J-Xmx1024m</additionalJOption> -->
       
<maxmemory>1024</maxmemory>
       
<failOnError>false</failOnError>
       
<links>
           
<link>http://download.oracle.com/javase/6/docs/api/</link>
           
<link>http://google-web-toolkit.googlecode.com/svn/javadoc/latest/</link>
       
</links>
       
<outputDirectory>${project.build.directory}/javadoc</outputDirectory>
       
<reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
       
<excludes>
           
<exclude>**/*.txt</exclude>
       
</excludes>
       
<header>
            <![CDATA[
               
<a href="https://github.com/..." target="_blank">Home</a>
            ]]>
       
</header>
   
</configuration>
   
<executions>
       
<execution>
           
<id>aggregate</id>
           
<goals>
               
<goal>aggregate</goal>
           
</goals>
           
<phase>site</phase>
       
</execution>
   
</executions>
</plugin>

3. Setup the GitHub plugin.
<!-- run 'mvn ghSite:site -X' to debug -->
<plugin>
   
<groupId>com.github.github</groupId>
   
<artifactId>site-maven-plugin</artifactId>
   
<version>${github.version}</version>
   
<configuration>
       
<!-- <dryRun>true</dryRun> -->
       
<outputDirectory>javadoc</outputDirectory>
       
<path>${project.version}</path>
       
<message>Creating site for ${project.version}</message>
       
<!-- sets the ~/.m2/setting.xml profile -->
       
<server>github</server>
       
<outputDirectory>${project.build.directory}/site/javadoc</outputDirectory>
   
</configuration>
   
<executions>
       
<execution>
           
<goals>
               
<goal>site</goal>
           
</goals>
           
<phase>site</phase>
       
</execution>
   
</executions>
</plugin>
4. Upload the Javadocs by running 'mvn site'







Comments