Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 633
Withheld Avatar asked Dec 09 '13 20:12

Withheld


People also ask

How do you rename a maven file?

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.

What is Maven resources plugin?

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.

How do I copy files from one directory to another in Maven?

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.

Which plugin is used to copy filter include?

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.


1 Answers

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

like image 131
Daniel Kaplan Avatar answered Nov 08 '22 12:11

Daniel Kaplan