Maven map a file
In Maven, is there a way to map one file to another file with a different name? I know there is a way to map a file to a different file with the same name under a certain directory with the following:
<mapping>
<directory>/some/path/to/dir</directory>
<sources&g开发者_开发知识库t;
<source>/some/path/to/file/xyz</source>
</sources>
</mapping>
This will map /some/path/to/file/xyz
to /some/path/to/dir/xyz
. Instead I'd like to have /some/path/to/file/xyz
be mapped to /some/path/to/dir/abc
. Is there a clean maven way of doing this?
Thanks!
No directly. You can use Ant's copy task via the antrun maven plugin. See Mapping File Names
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase> <!-- a lifecycle phase --> </phase>
<configuration>
<target>
<copy todir="/some/path/to/dir">
<fileset dir="/some/path/to/file/"/>
<mapper/><!-- you'll make the name mapping configuration here-->
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
精彩评论