Dependency

Stable version:

<dependency>
    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-core</artifactId>
    <version>5.7.0</version>
</dependency>

Snapshot version:

<dependencies>
    <dependency>
        <groupId>fr.inria.gforge.spoon</groupId>
        <artifactId>spoon-core</artifactId>
        <version>5.8.0-SNAPSHOT</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>gforge.inria.fr-snapshot</id>
        <name>Maven Repository for Spoon Snapshot</name>
        <url>http://spoon.gforge.inria.fr/repositories/snapshots/</url>
        <snapshots />
    </repository>
</repositories>

Plugin

A Maven plugin allows easily launching Spoon when using Maven. This plugin is available in Maven Central and can be directly inserted in a pom.xml file at the root of a project (or in the pom.xml of one of a maven module, where you want use Spoon).

<plugin>
  <groupId>fr.inria.gforge.spoon</groupId>
  <artifactId>spoon-maven-plugin</artifactId>
  <version>2.2</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>generate</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <processors>
      <processor>fr.inria.gforge.spoon.processors.CatchProcessor</processor>
    </processors>
  </configuration>
  <!-- To be sure that you use the latest version of Spoon, specify it as dependency. -->
  <dependencies>
    <dependency>
      <groupId>fr.inria.gforge.spoon</groupId>
      <artifactId>spoon-core</artifactId>
      <version>5.7.0</version>
    </dependency>
  </dependencies>
</plugin>

You simply specify your processors, in fully qualified name, in the configuration of the plugin, the processors will be applied on your target project before compilation.

In short, the Maven plugin gives the classpath of your project to Spoon, applies Spoon on all source directories and rewrites the transformed Java files in the target directory. These parameters can be changed in the configuration of the plugin.

To know more about this Maven plugin, check the README of its GitHub project.