Thanks to Andreas Hoheneder



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@209401 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-07-06 03:09:21 +00:00
parent 2e796ceb04
commit f04f9ed2a6
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,11 @@
<artifactId>maven-model</artifactId> <artifactId>maven-model</artifactId>
<version>2.0-beta-1-SNAPSHOT</version> <version>2.0-beta-1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>

View File

@ -20,6 +20,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.maven.model.Resource; import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.InterpolationFilterReader; import org.codehaus.plexus.util.InterpolationFilterReader;
@ -41,6 +42,7 @@ import java.util.TreeMap;
/** /**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @author Andreas Hoheneder
* @version $Id$ * @version $Id$
* @goal resources * @goal resources
* @phase process-resources * @phase process-resources
@ -79,6 +81,13 @@ public class ResourcesMojo
*/ */
private File filterPropertiesFile; private File filterPropertiesFile;
/**
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;
private Properties filterProperties; private Properties filterProperties;
private static final String[] EMPTY_STRING_ARRAY = {}; private static final String[] EMPTY_STRING_ARRAY = {};
@ -211,6 +220,8 @@ public class ResourcesMojo
// support @token@ // support @token@
reader = new InterpolationFilterReader( reader, filterProperties, "@", "@" ); reader = new InterpolationFilterReader( reader, filterProperties, "@", "@" );
reader = new InterpolationFilterReader( reader, new ReflectionProperties( project ), "${", "}" );
fileWriter = new FileWriter( to ); fileWriter = new FileWriter( to );
IOUtil.copy( reader, fileWriter ); IOUtil.copy( reader, fileWriter );