0

我想在我的 Intellij 项目中设置一个文件夹作为测试资源文件夹,并让 Intellij IDE 将整个文件夹复制到我的输出目录并保持顶级文件夹到位。

例如,这是一个基本的项目结构:

src/
 - stack/
  - overflow/
   - question/
    - SomeClass.java
tst/
 - stack/
  - overflow/
   - question/
    - SomeClassTest.java
files/
 - testfile.txt
 - testdoc.doc
 - testpdf.pdf
test-configuration/
 - default.properties
 - test-configuration.xml

应该编译并创建一个输出目录,如:

out/
 - stack/
  - overflow/
   - question/
    - SomeClass.class
 - test-configuration/
  - default.properties
  - test-configuration.xml
 - files/
  - testfile.txt
  - testdoc.doc
  - testpdf.pdf

问题是,只需将test-configurationfiles目录标记为Test Resources Root(或Resources Root)文件夹,总是会产生以下输出目录结构:

out/
 - stack/
  - overflow/
   - question/
    - SomeClass.class
 - default.properties
 - test-configuration.xml
 - testfile.txt
 - testdoc.doc
 - testpdf.pdf

Intellij 似乎只复制资源文件夹的内容,而不是整个目录。有没有办法设置 Intellij 复制根目录以维护输出中的目录结构?

4

1 回答 1

0

不,没有这样的方法。资源根目录就是:一个目录,其内容被复制到输出目录的目录。如果你需要额外的结构,你需要创建一个“resources”目录,将它标记为资源根目录,然后将你的“test-configuration”和“files”目录移动到其中。

于 2015-01-29T21:05:45.753 回答