Usage

The plugin need jdk 1.5+ to run (like Spoon).

Add the plugin to pom

 <project>
...
  <build>
    <plugins>
...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>net.sf.alchim</groupId>
        <artifactId>spoon-maven-plugin</artifactId>
        <version>0.7</version>
        <executions>
          <execution>
            <goals>
              <goal>recompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
...
    </plugins>
  </build>
...
  <reporting>
    <plugins>
...
      <!-- generate an html report from spoonlet execution -->
      <plugin>
        <groupId>net.sf.alchim</groupId>
        <artifactId>spoon-maven-plugin</artifactId>
        <version>0.7</version>
      </plugin>
...      
    </plugins>
  </reporting>
  
</project>
 

See the goals of the plugin to find the right goal for your case, and associated configuration.

Configure the spoonlets

Create a spoon.cfg.xml file in the same directory as pom.xml. The file list the spoonlets to apply during the build.

<?xml version="1.0" encoding="UTF-8"?>
<spoon>
  <-- list of repository where to search/download spoonlets -->
  <repository url="http://maven-repo.gforge.inria.fr/releases"/>
  <repository url="http://alchim.sf.net/download/releases"/>

  <-- list of spoonlets to apply -->

  <spoonlet artifactId="alchim-codeplus" groupId="net.sf.alchim" version="0.4"/>
  
  <!-- list of processor to enable/disable or reconfigure (same syntax as spoon.xml) -->

  <processor name="Get &amp; Set Generator" class="net.sf.alchim.codeplus.spoonprocessor.StupidGetSetGenerator" active="true" doc="generate getter and setter for public fields">
    <property name="generateOnlyOnAnnotation" doc="generate accessor for public field only when @GenStupidGetSet is present or always" value="false"/>
  </processor>

  <processor name="toString Generator" class="net.sf.alchim.codeplus.spoonprocessor.ToStringGenerator" active="false" doc="generate toString()"/>

  <processor name="Empty Catch Checker" class="net.sf.alchim.codeplus.spoonchecker.EmptyCatchAnalyzer" active="false"/>
  <processor name="Javadoc Checker" class="net.sf.alchim.codeplus.spoonchecker.JavadocAnalyzer" active="false"/>
  <processor name="Empty method Checker" class="net.sf.alchim.codeplus.spoonchecker.EmptyMethodBodyAnalyzer" active="false"/>
  <processor name="Package circular ref Checker" class="net.sf.alchim.codeplus.spoonchecker.CircularPackageDepAnalyzer" active="true"/>
  <processor name="Type circular ref Checker" class="net.sf.alchim.codeplus.spoonchecker.TypeReferenceAnalyzer" active="true"/>
  <processor name="Field name Checker" class="net.sf.alchim.codeplus.spoonchecker.FieldNameAnalyzer" active="false"/>

</spoon>