Reputation: 22948
How to exclude files from src/main/resources, for ex : I have a folder named "map" in there, which I wanna keep and I want to delete everything from war(or not to package it inside at firstplace).
Or alternative but same result, exclude all *.resources files from src/main/resources and put in war everything else?
Thank you
Upvotes: 3
Views: 5816
Reputation: 116266
You may configure your resources like this:
<build>
<resources>
<resource>
<directory>src/main/resources/map</directory>
</resource>
</resources>
</build>
or this:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.log</exclude>
</excludes>
</resource>
</resources>
</build>
For more details, click here.
Upvotes: 10
Reputation: 570345
If you don't want some resources to be copied into target/classes
, you can define includes
or excludes
in the resource
element as documented in Including and excluding files and directories. For example:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/map/*.*</exclude>
</excludes>
</resource>
</resources>
</build>
If you want resources to be still copied into target/classes
but for some reason don't want them to be packaged in the final artifact, then configure the maven war plugin to use packagingExcludes
.
Upvotes: 4
Reputation: 3129
The official documentation for the maven resources plugin describes how you can perform includes and excludes.
http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
Upvotes: 0