View Javadoc
1   package org.codehaus.mojo.sqlj;
2   
3   import java.io.IOException;
4   
5   import org.apache.commons.io.FileUtils;
6   import org.apache.maven.plugin.MojoExecutionException;
7   import org.apache.maven.plugin.MojoFailureException;
8   import org.apache.maven.plugins.annotations.LifecyclePhase;
9   import org.apache.maven.plugins.annotations.Mojo;
10  
11  /**
12   * Cleans out generated stale resources.
13   * 
14   * @author <a href="mailto:david@codehaus.org">David J. M. Karlsen</a>
15   */
16  @Mojo( name = "clean", defaultPhase = LifecyclePhase.CLEAN )
17  public class CleanMojo
18      extends AbstractSqljMojo
19  {
20  
21      /**
22       * {@inheritDoc}
23       */
24      public void execute()
25          throws MojoExecutionException, MojoFailureException
26      {
27          try
28          {
29              FileUtils.deleteDirectory( getGeneratedSourcesDirectory() );
30              FileUtils.deleteDirectory( getGeneratedResourcesDirectory() );
31          }
32          catch ( IOException e )
33          {
34              throw new MojoFailureException( e.getMessage() );
35          }
36      }
37  
38  }