如何使用Maven将整个目录复制到另一个目录? [英] How can I copy an entire directory into another directory using Maven?

查看:99
本文介绍了如何使用Maven将整个目录复制到另一个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在不使用Mmaven antrun插件的情况下使用Maven将整个目录复制到另一个目录中.

I want to know how to copy an entire directory into another directory using Maven without using the Mmaven antrun plugin.

推荐答案

您可以使用 Maven资源插件.

以他们的文档中的示例为例:

As an example taken from their documentation:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <!-- here the phase you need -->
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/extra-resources</outputDirectory>
              <resources>          
                <resource>
                  <directory>src/non-packaged-resources</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>
    </plugins>
    ...
  </build>
  ...
</project>

如果我没记错的话,这会将directory的内容复制到outputDirectory中.

This would copy the content of the directory into the outputDirectory if I'm not mistaken.

这篇关于如何使用Maven将整个目录复制到另一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆