1 package org.codehaus.mojo.gwt;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.IOException;
24
25 import org.apache.maven.plugin.MojoExecutionException;
26 import org.apache.maven.plugin.MojoFailureException;
27 import org.apache.maven.plugins.annotations.Mojo;
28 import org.codehaus.mojo.gwt.utils.GwtModuleReaderException;
29 import org.codehaus.plexus.util.FileUtils;
30
31
32
33
34
35
36 @Mojo(name = "clean", threadSafe = true)
37 public class GwtCleanMojo
38 extends AbstractGwtModuleMojo
39 {
40
41
42
43
44
45
46 public void execute()
47 throws MojoExecutionException, MojoFailureException
48 {
49 try
50 {
51 for ( String name : getModules() )
52 {
53 File output = new File( getOutputDirectory(), readModule( name ).getPath() );
54 clean( output );
55 }
56 clean( new File( getOutputDirectory(), ".gwt-tmp" ) );
57 }
58 catch ( GwtModuleReaderException e )
59 {
60 throw new MojoExecutionException( e.getMessage(), e );
61 }
62 }
63
64 private void clean( File output )
65 {
66 try
67 {
68 FileUtils.deleteDirectory( output );
69 }
70 catch ( IOException e )
71 {
72 getLog().warn( "Failed to delete directory " + output );
73 }
74 }
75 }