0

我有两个要使用 maven-resources-plugin 执行的复制任务。例如,我需要从复制config.ymlsrc/main/resources根文件夹并将所有文件夹内容从复制/src/main/resources/examplessrc/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>

但我只能添加一个目标文件夹。

4

1 回答 1

0

您可以使用不同的 ID 和配置创建另一个执行:

<execution>
    <id>copy-resources-2</id>
    <phase>validate</phase>
    <goals>
        <goal>copy-resources</goal>
    </goals>
    <configuration>
        ...
    </configuration>
</execution>
于 2014-01-28T15:11:59.527 回答