Reputation: 1065
I'd like to copy eclipse.properties.ref as eclipse.properties if eclipse.properties does not exist. I'm using maven 3.2 and Java 7.
I tried the following, but not sure how to map the old file to new.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>/src/test/resources</outputDirectory>
<resources>
<resource>
<directory>/src/test/resources</directory>
<includes>
<include>eclipse.properties.ref</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 2
Views: 1346
Reputation: 11270
You can achieve your goal using maven-antrun-plugin
. It seems like copy
does exactly is what you need.
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property
name="resources"
value="${project.basedir}/src/test/resources" />
<copy
overwrite="false"
file="${resources}/eclipse.properties.ref"
toFile="${resources}/eclipse.properties" />
</target>
</configuration>
</execution>
</executions>
NOTE
Also I'd suggest you to copy to ${project.build.testOutputDirectory}
instead of ${project.basedir}/src/test/resources
so it's will not hurt your version control system.
Upvotes: 2