我有两个复制任务,我想用maven-resources-plugin做。例如,我需要将config.yml
从src/main/resources
复制到根文件夹,并将所有文件夹内容从/src/main/resources/examples
复制到src/examples
。
root
/src
/main
/resources --> config.yml (to root)
/examples --> all folder contents (to /src/examples)
我发现的唯一解决方案是:
<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>
但我只能添加一个目标文件夹。
答案 0 :(得分:0)
您可以使用不同的ID和配置创建另一个执行:
<execution>
<id>copy-resources-2</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
...
</configuration>
</execution>