Maven is by default looking for resource files i.e. *.xml, *.properties and etc. in src/main/resources
directory. It is recommended to put your resource files under here.
However, nothing prevent you from putting resource files somewhere else, for instance, src/main/java/org/wpse/db/config/
, as some people prefer to put resource files along with class file under special package, you just need a little more configuration in pom.xml:
<build>
<resources>
<resource>
<!-- This include everything else under src/main/java directory -->
<directory>${basedir}/src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
... ...
</build>
Related question: how to customize maven to generate the .classpath that i want?
By default configuration, when running mvn eclipse:eclipse
it generates following .classpath file:
<classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
... ...
</classpath>
... ...
When importing into Eclipse, it gives you following classpath (what you don't want):
Using the pom configuration above, when running 'mvn eclipse:eclipse' it generates following .classpath file:
<classpath>
<classpathentry kind="src" path="src/main/java"/>
... ...
</classpath>
... ...
When importing into Eclipse, it gives you follwing classpath (what you want):
src/main/java
orsrc/main/resources
? – Decrial