Copying a single file then renaming it using maven-resources-plugin -- possible?

Withheld picture Withheld · Dec 9, 2013 · Viewed 13.9k times · Source

I copy a single WSDL file from a different project tree, using maven-resources-plugin, as follows:

<execution>
    <id>copy-wsdl-and-rename-it</id>
    <phase>validate</phase>
    <goals>
        <goal>copy-resources</goal>
    </goals>
    <configuration>
        <outputDirectory>${basedir}/src/main/wsdl</outputDirectory>
        <resources>
            <resource>
                <directory>${basedir}/../myws/src/main/wsdl</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </configuration>
</execution>

This works well, but now I need to rename the (single) file under that wsdl directory to something else (e.g. from myws.wsdl in the source directory to my.wsdl in the destination directory).

Is there a way to accomplish this, using the maven-resources-plugin, without resorting to another plugin?

Answer

Daniel Kaplan picture Daniel Kaplan · Dec 10, 2013

I don't see a way to do exactly what you're asking for. Why do you have the restriction of not using another plugin? If you change your mind about that here's the answer: Renaming resources in Maven