1 package org.apache.maven.plugin.assembly.io;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.shared.io.location.FileLocation;
23 import org.apache.maven.shared.io.location.Location;
24 import org.apache.maven.shared.io.location.LocatorStrategy;
25 import org.apache.maven.shared.io.logging.MessageHolder;
26
27 import java.io.File;
28
29
30
31
32 public class RelativeFileLocatorStrategy
33 implements LocatorStrategy
34 {
35
36 private File basedir;
37
38 public RelativeFileLocatorStrategy( File basedir )
39 {
40 this.basedir = basedir;
41 }
42
43 public Location resolve( String locationSpecification, MessageHolder messageHolder )
44 {
45 File file = new File( basedir, locationSpecification );
46 messageHolder.addInfoMessage( "Searching for file location: " + file.getAbsolutePath() );
47
48 Location location = null;
49
50 if ( file.exists() )
51 {
52 location = new FileLocation( file, locationSpecification );
53 }
54 else
55 {
56 messageHolder.addMessage( "File: " + file.getAbsolutePath() + " does not exist." );
57 }
58
59 return location;
60 }
61
62 }