Maven(surefire):从src / test / java复制测试资源 [英] Maven (surefire): copy test resources from src/test/java
问题描述
Maven的surefire(测试)插件将src / test / resources中的文件复制到target / test-classes。它在src / test / java中编译.java,并将编译的.class文件复制到target / test-classes。
Maven's surefire (testing) plugin copies files in src/test/resources to target/test-classes. It compiles .java in src/test/java, and copies the compiled .class files to target/test-classes.
但是它不会从src / test / java,并且将测试资源放在与它们作为资源的.java类相同的目录中比在src / test / resources中的并行层次中更方便。
But it doesn't copy resources from src/test/java, and it's more convenient to be able to put test resources in the same directory as the .java classes they are resources for, than in a parallel hierarchy in src/test/resources.
是否有可能让maven从src / test / java复制资源?
Is it possible to get maven to copy resources from src/test/java?
推荐答案
资源复制都是由maven-resource-plugin完成的,如果你阅读它的文档,你会看到如何从src / test / java中添加资源复制。
The resource copying is all done by the maven-resource-plugin, and if you read the doc thereof you will see how to add copying of resources from src/test/java.
http://maven.apache.org/plugins/maven-resources-plugin/testResources-
See http://maven.apache.org/plugins/maven-resources-plugin/testResources-mojo.html for the test-resources goal, which is included in the default lifecycle.
然后参阅 http://maven.apache.org/pom.html ,然后查找< testResources>
。
这篇关于Maven(surefire):从src / test / java复制测试资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!