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 import java.util.Collection;
25
26 import org.apache.maven.plugin.MojoExecutionException;
27 import org.apache.maven.plugin.MojoFailureException;
28 import org.apache.maven.plugins.annotations.LifecyclePhase;
29 import org.apache.maven.plugins.annotations.Mojo;
30 import org.apache.maven.plugins.annotations.Parameter;
31 import org.codehaus.plexus.util.FileUtils;
32
33
34
35
36
37
38
39
40
41 @Deprecated
42 @Mojo(name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, threadSafe = true)
43 public class GwtResourcesMojo
44 extends GwtResourcesBaseMojo
45 {
46 @Parameter(defaultValue = "${project.build.outputDirectory}", required = true, readonly = true)
47 private File outputDirectory;
48
49
50
51
52
53
54 public void execute()
55 throws MojoExecutionException, MojoFailureException
56 {
57 Collection<ResourceFile> files = getAllResourceFiles();
58 for ( ResourceFile file : files )
59 {
60 File f = new File( file.basedir, file.fileRelativeName );
61 File target = new File( outputDirectory, file.fileRelativeName );
62 try
63 {
64 getLog().debug( "copy " + f + " to outputDirectory" );
65 if ( !target.getParentFile().exists() )
66 {
67 if ( !target.getParentFile().mkdirs() )
68 {
69 throw new MojoExecutionException( "Failed to create destination directory "
70 + target.getParentFile() );
71 }
72 }
73 FileUtils.copyFile( f, target );
74 }
75 catch ( IOException e )
76 {
77 throw new MojoExecutionException( "Failed to copy GWT source " + f, e );
78 }
79 }
80 }
81 }