资源未复制到IntelliJ 12.1.4中的输出路径 [英] Resources not copied to output path in IntelliJ 12.1.4

查看:224
本文介绍了资源未复制到IntelliJ 12.1.4中的输出路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎已经做了一些事情来告诉IntelliJ不要将源资源(例如XML和属性文件)复制到编译器输出文件夹。

I seem to have done something to tell IntelliJ to not copy source resources (e.g. XML and property files) to the compiler output folder.

没有复制资源到编译器输出路径。 测试资源会复制到测试输出文件夹,但不会复制资源。

Resources are not being copied to the Compiler output path. Test resources are copied to the test ouput folder, but no source resources are copied.

来源文件夹: src

(这是 C:\ dev \\ \\ myproject\src 并包含XML文件)

(this is C:\dev\myproject\src and contains XML files)

测试源文件夹: 测试\integration\src

(这是 C:\ dev\myproject\tests \ integration \src 并包含XML文件)

(this is C:\dev\myproject\tests\integration\src and contains XML files)

编译器输出:


  • 使用模块编译输出路径

  • 输出路径: C:\dev\myproject \ buildd \\ classes

  • 测试输出路径: C:\ dev\myproject\build\test

  • Use module compile output path
  • Output path: C:\dev\myproject\build\classes
  • Test output path: C:\dev\myproject\build\test

设置 - >编译器 - >资源模式:
?*。properties;?* .XML;?* GIF; * PNG;?* JPEG; *。JPG; * HTML;?* DTD;?* TLD; * FTL

Settings -> Compiler -> Resource patterns: ?*.properties;?*.xml;?*.gif;?*.png;?*.jpeg;?*.jpg;?*.html;?*.dtd;?*.tld;?*.ftl

这阻止我运行从类路径加载文件的集成测试。 (我没有完全控制这个遗留项目的结构,大多数其他开发人员都使用Eclipse。)

This is preventing me from running integration tests which load files from the classpath. (I do not have full control over the structure of this legacy project and most of the other developers use Eclipse.)

任何人都可以给我一些指示我需要什么为了让IntelliJ将资源复制到输出文件夹?

Can anyone give me some pointers as to what I need to do in order to have IntelliJ copy the resource to the output folders?

推荐答案

我使用Maven对IntelliJ IDEA 13有同样的问题。

i had same problems with IntelliJ IDEA 13 using Maven.

我通过将它添加到pom.xml文件中的 build 标记来解决它:

i solved it by adding this to my build tag in the pom.xml file:

<build>
...
<resources>
  <resource>
    <directory>src/com</directory>
    <targetPath>com</targetPath>
    <includes>
      <include>**/*.xml</include>
    </includes>
  </resource>
</resources>
...
</build>

根据您的项目更改路径。有关 Maven Resources Plugin 的更多信息。

change path according to your project. More about the Maven Resources Plugin here.

这篇关于资源未复制到IntelliJ 12.1.4中的输出路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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