0

I have many subfolder in my src/test/resources and what I want to do is filter each subfolder with a specific filter file which resides in src/test/filters:

I tried something like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <executions>

        <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>testResources</goal>
            </goals>
            <configuration>
                <resources>
                    <resource>
                        <outputDirectory>${basedir}/target/annonce</outputDirectory>
                        <directory>${basedir}/src/test/resources/annonce</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
                <filters>
                    <filter>${basedir}/src/test/filters/annonce/filter.properties</filter>
                </filters>
            </configuration>
        </execution>

        <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>testResources</goal>
            </goals>
            <configuration>
                <outputDirectory>${basedir}/target/profil</outputDirectory>
                <overwrite>true</overwrite>
                <resources>
                    <resource>
                        <directory>${basedir}/src/test/resources/profil</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
                <filters>
                    <filter>${basedir}/src/test/filters/profil/filter.properties</filter>
                </filters>
            </configuration>
        </execution>
    </executions>
</plugin>

But I get the error that said that the id should be unique. I tried to use for the second execution copy-resources id and goal but it's not working, so I wonder if there is any ideas?

Mardoz
  • 1,617
  • 1
  • 13
  • 26
oussama.elhadri
  • 738
  • 3
  • 11
  • 27

1 Answers1

1

Simply change one of the ids

org.apache.maven.plugins maven-resources-plugin 2.6

    <execution>
        <id>default-testAnnonce</id>
        ...
    </execution>

    <execution>
        <id>default-testProfil</id>
        ...
    </execution>
</executions>

jhamon
  • 3,603
  • 4
  • 26
  • 37