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?
The project build is on two step. First maven-resources-plugin is used at the copy-resources lifecycle phase to filter the resources located under /src/main and copy them to the target directory. Next, copy-rename-maven-plugin is used to rename the filtered output file file-to-rename. txt to renamed-file.
The Resources Plugin handles the copying of project resources to the output directory. There are two different kinds of resources: main resources and test resources.
Using the Copy Rename Maven Plugin The copy-rename-maven-plugin helps copying files or renaming files/directories during the Maven build lifecycle. Upon building the project, we'll see foo. txt in the target/destination-folder.
Including And Excluding Files/Directories: The Maven Resources Plugin helps us configure which files and directories to include or exclude while copying the resources to our build output. To include files, we'll need to add an <includes> element.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With