I created a new Project from scratch in IntelliJ by using a Maven Module
. I didn't select any specific archetypes and I clicked on finish. The project gets created nicely and I have the java
and resources
folders under src/main as expected.
Unfortunately, my application does not find any property files in the resources
folder because it looks in the project base folder instead.
I double checked that the resources folder is marked as 'source folder' in the Project Structure and I also tried to add the following to the pom.xml with no success:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
I'm using Maven 2.2.1 and IntelliJ 11.1, Any thoughts??
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. ).
To do this, open the File > Project Structure dialog, select the Modules tab, and click on the resources folder. The result will be as shown below. Your application can now access resources from the resources folder.
There is a bug in Intellij 12 please go to Settings->Compiler and un-check "Use external build" check box - the idea behind it was that it was suppose to run faster with a compiler run in a separate process but in fact there is a bug and when using maven it does not copy resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With