0

我的 src/test/resources 中有很多子文件夹,我想做的是使用 src/test/filters 中的特定过滤器文件过滤每个子文件夹:

我试过这样的事情:

<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>

但是我得到一个错误,说 id 应该是唯一的。我试图用于第二次执行copy-resources idgoal但它不起作用,所以我想知道是否有任何想法?

4

1 回答 1

1

只需更改其中一个 id

org.apache.maven.plugins Maven 资源插件 2.6

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

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

于 2014-05-17T09:11:53.777 回答