why xml files in eclipse project's source directory is not copied to target/classes directory?
buildpath, eclipse, eclipse-project-file, maven, xml
Solution
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):
Problem
this issue is not the same as MyBatis 3.0.5 and mappers loading problem and How to suppress Maven "Unable to find resource" messages? i have xml files in org.org.wpse.db.config.db.config package, but why i cannot find these xml files in target/classes/org/wpse/db/config/ directory even after i run mvn compile. this error leads to the following faillure when i use mybatis: ``` Could not find resource ``` the issue which lead to this error is that the .xml files are not copied to the build dir, even i when i used mvn compile explicitly