tags:

views:

71

answers:

3

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

A: 

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

Geoff
Filtering is something else, filtering allows to replace tokens by values.
Pascal Thivent
Yeah, sorry, I meant to (and now have) link to the include exclude bit, but got carried away.
Geoff
+1  A: 

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</include>
           </excludes>
        </resource>
    </resources>
</build>

For more details, click here.

Péter Török
+2  A: 

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.

Pascal Thivent