So, my pom.xml has the following:
<build>
<resources>
<resource>
<directory>.</directory>
<excludes>
<exclude>.settings/</exclude>
<exclude>src/</exclude>
<exclude>target/</exclude>
<exclude>.classpath</exclude>
<exclude>.gitignore</exclude>
<exclude>.project</exclude>
<exclude>logging.log</exclude>
<exclude>mvn_cmd.bat</exclude>
<exclude>pom.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
...
My goal is to copy a single file(e.g. config.properties
) located at the root of my project and copy it into target/classes when I do a Maven > Update
with Eclipse. So far the only way I found to fix this issue is to manually exclude all the files from from my ${basedir}
directory.
I believe this can be done directly rather easily with the maven native command, but I need to get this working with m2eclipse as well.
I figured the best way to do this, would be a regex to exclude everything but my config.properties
, but I don't known if maven has this kind of feature.
Try using includes instead of excludes, and note that the directory is the root of the project, like this:
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>config.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
<resources>