从我的Maven项目复制文件 [英] Copying files from my project in Maven

查看:60
本文介绍了从我的Maven项目复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些Maven阶段是否可以将文件夹从项目复制到特定位置?有人知道吗?

Is it possible to copy folders from my project to a certain location during some Maven phase? Does anybody know how?

推荐答案

Maven的实现方法是使用maven-resources-plugin

The Maven way of doing this would be using the copy-resources goal in maven-resources-plugin

来自 http://maven.apache.org /plugins/maven-resources-plugin/examples/copy-resources.html

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</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>

这篇关于从我的Maven项目复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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