View Javadoc
1   /*
2    * #%L
3    * Mojo's Maven plugin for Cobertura
4    * %%
5    * Copyright (C) 2005 - 2013 Codehaus
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package org.codehaus.mojo.cobertura;
21  
22  import org.apache.maven.plugin.MojoExecutionException;
23  import org.apache.maven.plugin.MojoFailureException;
24  
25  /**
26   * Clean up the files that Cobertura Maven Plugin has created during
27   * instrumentation.
28   *
29   * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
30   * @goal clean
31   * @phase clean
32   */
33  public class CoberturaCleanMojo
34      extends AbstractCoberturaMojo
35  {
36      /**
37       * {@inheritDoc}
38       */
39      public void execute()
40          throws MojoExecutionException, MojoFailureException
41      {
42          if ( skipMojo() )
43          {
44              return;
45          }
46  
47          if ( getDataFile().exists() )
48          {
49              getDataFile().delete();
50          }
51      }
52  }