Surodip
Surodip

Reputation: 487

Exclude resource folder from WAR using Maven

I am converting our ant build to maven using eclipse STS m2e. Now I have a problem:

I have a mapping folder under src/main/resources like below:

enter image description here

and the mapping folder has some .xml files.

Now I want to copy all the .xml files under mapping folder to WEB-INF/classes folder in the final WAR and for that I did this:

<resources>
...
        <resource>
            <directory>${basedir}\src\main\resources</directory>
        </resource>
        <resource>
            <directory>${basedir}\src\main\resources\mapping</directory>
        </resource>
...
</resources>

By doing this it is also creating a mapping folder in the WAR under WEB-INF/classes. How can I exclude this mapping folder, as all the contents are already added under WEB-INF/classes path directly.

Please Help.

Upvotes: 1

Views: 1172

Answers (1)

michaldo
michaldo

Reputation: 4599

        <resource>
            <directory>${basedir}/src/main/resources</directory>
            <excludes><exclude>mapping/</exclude></excludes>
        </resource>
        <resource>
            <directory>${basedir}/src/main/resources/mapping</directory>
        </resource>

Upvotes: 2

Related Questions