Groovydoc Maven Plugin
No more crazy Ant in your poms.
It turns out, that the javadoc plugin for Maven doesn’t actually generate anything useful for Groovy projects. Further, when releasing artifacts to Apache Maven Central, you actually need Javadocs. So generating Groovydocs (which generates Groovy and Javadocs) turns out to be a fairly good idea, but the only method for doing it turned out to be an Ant task, which is a whole lot of crazy to have in your parent poms.
This plugin encapsulates the functionality of the Groovydoc plugin in its simplest form, package exclusions are not supported, it defaults to public APIs.
Enabling the plugin
Including the following in your POM will enable groovy docs to be generated with a -javadoc.jar extension and javadoc classifier.
<plugin>
<groupId>com.bluetrainsoftware.maven</groupId>
<artifactId>groovydoc-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>attach-docs</id>
<phase>package</phase>
<goals>
<goal>attach-docs</goal>
</goals>
</execution>
</executions>
</plugin>
Running the plugin directly
Please note, depending on which method of compiling Groovy you are using, you need to make sure that Maven knows about the sources folder. So typically you could:
mvn clean compile groovydoc:generate
Using Maven Tiles
You can use this plugin directly as a tile as each time it is released, you will get a new version flow into your build if you wish.
<tile>com.bluetrainsoftware.maven:groovydoc-maven-plugin:[1.3,2)</tile>
See the Maven Tiles plugin for more information.
Overrides
All of the known overrides can be specified, some do not work however (such as specifying excludes and includes). If there is a calling for it, I can implement it.
e.g.
<plugin>
<groupId>com.bluetrainsoftware.maven</groupId>
<artifactId>groovydoc-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>attach-docs</id>
<goals>
<goal>attach-docs</goal>
</goals>
</execution>
</executions>
<configuration>
<scope>private</scope>
</configuration>
</plugin>
Release Notes
1.3 - Javadoc Nuking
When releasing, the javadoc plugin is run regardless of your desire to have it run. This version fixes that so you don’t have to have it running.
-
forces the javadoc plugin to be skipped unless <forceSkipJavadoc>false</forceSkipJavadoc> is in your configuration.
2.1 - Upgrade to Groovy 2.4.12
Some internal package rejigging, but essentially just a Groovy upgrade.