Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ: how to make non java files copied to the bin directory as well?

My module contains some non java files along the java source files. When the module is built, the java files are copied to the bin folder (and included in the jar artifact), but the non java files are left out.

I need them to be copied as well (this is what Eclipse does). Note, that they do appear in the project tree view on the left, I did not exclude them in any way.

How can I make them get into the bin folder (jar artifact)?

Thanks.

like image 244
mark Avatar asked Jun 24 '12 11:06

mark


People also ask

What is bin in IntelliJ?

The "bin" folder is not a part of any standard Java project structure, and there is no such concept in IntelliJ IDEA. The "out" folder is where IntelliJ places the generated . class files and artifacts.

What is bin folder Java?

java files (human readable codes). "Bin" folder is usually where the compiled files are copied to (computer readable codes). For example, this folder will have the . class, . jar etc files which are compiled.

How do I create a resource folder in IntelliJ?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Project Settings | Modules. Select the necessary module and then open the Sources tab in the right-hand part of the dialog. Click Add Content Root and specify the folder that you want to add as a new content root. ).


3 Answers

Settings (Preferences on Mac) | Compiler | Resource Patterns.

This question duplicates/relates to:

  • copy jbehave stories into target directory using IntelliJ Idea
  • IntelliJ, Akka and Configuration files
  • IntelliJ IDEA 11.1.2 does not copy SQL files to the out folder
  • Add a properties file to IntelliJ's classpath
  • import images into an intelliJ Java project
  • Intellij - how do I add a text file to the resources
  • Null Pointer Exception for read properties file in Idea
  • IntelliJ Idea - resource SQL files not being copied to target
  • Scala getClass.getResource() returning null
like image 127
CrazyCoder Avatar answered Sep 23 '22 05:09

CrazyCoder


On IDEA 14.1.4, the xml file in src/main/java/my/package folder is not copied. My compiler settings are !?*.java;!?*.form;!?*.class;!?*.groovy;!?*.scala;!?*.flex;!?*.kt;!?*.clj;!?*.aj.

I changed the gradle file by adding:

test {
    resources {
        srcDir 'src/main/java'
        include '**/*.xml'
    }
}

It starts working. I am not sure if I have missed anything, but I could not find that part reflected on project settings.

If you are working with Maven, the following code should have the same effect:

<build>
    <testResources>
        <testResource>
            <filtering>false</filtering>
            <directory>src/test/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
        </testResource>
        <testResource>
            <directory>src/test/resources</directory>
        </testResource>
    </testResources>
</build>

I posted it here as an answer, because it may help someone who has the same issue and the above answers may not work.

like image 41
Devs love ZenUML Avatar answered Sep 21 '22 05:09

Devs love ZenUML


Uncheck use external build in project compiler setting.

like image 30
Morn Avatar answered Sep 24 '22 05:09

Morn