Maven:将文件从工作区复制到目标之外的文件夹 [英] Maven: copy file from workspace to folder which is outside of target

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

问题描述

在构建期间,我需要将5个properties文件从项目工作空间src/main/resources/my复制到文件夹C:\my(我在Windows 7上进行开发). C:\my存在但为空.

During build, I need to copy 5 properties files from my project workspace src/main/resources/my, to the folder C:\my (I develop on Windows 7). C:\my exists but empty.

我在pom.xml文件中使用了以下代码,但是这些文件没有被复制.

I am using the following code in my pom.xml file, but the files are not copied.

在构建过程中,我没有得到任何错误,但是得到了以下输出:

During the build, I do not get any error, but I am getting the following output:

[INFO] --- maven-resources-plugin:2.5:copy-resources (copy-my-resources) @ my-webapp ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources

请注意,它不会像复制成功时一样显示[INFO] Copying 5 resources to somewhere.

Pay attention, that it does not say [INFO] Copying 5 resources to somewhere as it usually does when the copy is successful.

但是,文件根本不会复制到C:\my.

However, the files are not copied to C:\my at all.

您能在我的xml代码中看到我应该更改的内容吗?

Could you see what I should change in my xml code?

以下是相关代码:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
    <executions>
            <execution>
                    <id>copy-my-resources</id>

                    <phase>process-resources</phase>

                    <goals>
                            <goal>copy-resources</goal>
                    </goals>
                    <configuration>

                            <!-- overwrite! -->
                            <overwrite>true</overwrite>

                            <outputDirectory>${env.HOMEDRIVE}/my</outputDirectory>
                            <resources>
                                    <resource>
                                            <directory>src/main/resources/my</directory>
                                            <filtering>false</filtering>
                                            <includes>
                                                <include>**/*.properties</include>
                                            </includes>
                                    </resource>
                            </resources>
                    </configuration>
            </execution>
    </executions>
</plugin>

推荐答案

您可以run mvn -X ...命令从所有插件获取更详细的调试输出.

You can run mvn -X ... command to get more detailed debug output from all plugins.

还要确保已定义$ {env.HOMEDRIVE}属性,并且存在$ {env.HOMEDRIVE}/my文件夹.

Also make sure that ${env.HOMEDRIVE} property is defined and ${env.HOMEDRIVE}/my folder exists.

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

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