I'm currently working on an existing project which has a pom.xml file with the following:
<resources>
<resource>
<filtering>false</filtering>
<directory>src</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
I have in the base path a directory called properties which contains properties files. I want to copy when packaging all the properties files contains under properties/ in my src directory (otherwise the program will crash due to missing configuration files).
So my question is:
How can i, with Maven include resource files that are not located under src directory?
I try this one but it doesn't seem to work:
<resources>
<resource>
<filtering>false</filtering>
<directory>src</directory>
<includes>
<include>**/*.properties</include>
<include>../properties/**</include>
</includes>
</resource>
</resources>
Thank's for your help.
If your file structure is like this: Standard Directory Layout
Then you dont have to add the resources elemt.
Maven copies by default all the files and folders that are located in your /src/main/resources folder to your build folder and locates them in the root of your compiled classpath files.
if you have for example a file called configuration.properties located in /src/main/resources/configuration.properties
then when running mvn clean compile
this file will be copied to your /target/classes/configuration.properties
So if you remove that part the files will be located where u want them
<resource>
<filtering>false</filtering>
<directory>src</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>