0

I have two copy tasks that I want to do with maven-resources-plugin. For example I need to copy config.yml from src/main/resources to root folder and to copy all folder contents from /src/main/resources/examples to src/examples.

root
  /src
    /main
      /resources   --> config.yml (to root)
        /examples  --> all folder contents (to /src/examples)

The only one solution I've found is this:

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
    <execution>
        <id>copy-resources</id>
        <phase>validate</phase>
        <goals>
            <goal>copy-resources</goal>
        </goals>
        <configuration>
            <outputDirectory>${basedir}</outputDirectory>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/config.yml</include>
                    </includes>
                </resource>
                <!-- <resource>
                    <directory>src/main/resources/examples</directory>
                </resource> -->
            </resources>
        </configuration>
    </execution>
</executions>
</plugin>

but I can add only one destination folder.

rand0m86
  • 3,172
  • 4
  • 26
  • 29
  • 1
    why do you copy it to src/* ? you should be using target folder. Anyway you cam create another execution with different ID and configuration – hoaz Jan 28 '14 at 14:57
  • That's a good idea about another execution phase, thanks. – rand0m86 Jan 28 '14 at 15:09

1 Answers1

0

You can create another execution with different ID and configuration:

<execution>
    <id>copy-resources-2</id>
    <phase>validate</phase>
    <goals>
        <goal>copy-resources</goal>
    </goals>
    <configuration>
        ...
    </configuration>
</execution>
hoaz
  • 9,883
  • 4
  • 42
  • 53