Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources not copied to output path in IntelliJ 12.1.4

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.

Source folder: src

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

Test Source folder: tests\integration\src

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

Compiler output:

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

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

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.)

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?

like image 662
vegemite4me Avatar asked Jun 11 '13 08:06

vegemite4me


People also ask

How do I change the output path in Intellij?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S . Under Project Settings, select Modules | Paths. Change the paths specified in the Output path and Test output path or select Inherit project compile output path to use the paths specified for the project.


1 Answers

i had same problems with IntelliJ IDEA 13 using Maven.

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>

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

like image 112
Chris Avatar answered Sep 20 '22 11:09

Chris