我的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
id
和goal
,但它不起作用,所以我想知道是否有任何想法?
答案 0 :(得分:1)
只需更改其中一个ID
即可org.apache.maven.plugins Maven的资源 - 插件 2.6
<execution>
<id>default-testAnnonce</id>
...
</execution>
<execution>
<id>default-testProfil</id>
...
</execution>
</executions>