Apache Maven Resources Plugin exclude a directory

kdoteu picture kdoteu · Jan 15, 2015 · Viewed 11.4k times · Source

I'm trying to copy some resources from one point to an other during the build process. Therefore I use the Apache Maven Resources Plugin. Actually I exclude some files, I don't need. But I want also to exclude a directory. I tried serveral ways but it didn't work.

<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
    <execution>
        <id>copy-client-product</id>
        <phase>verify</phase>
        <goals>
            <goal>copy-resources</goal>
        </goals>
        <configuration>
            <outputDirectory>${basedir}/target/pro/client</outputDirectory>
            <resources>
                <resource>
                    <directory>target\products\client\win32\win32\x86\</directory>
                    <excludes>
                        <exclude>p2</exclude>
                        <exclude>eclipsec.exe</exclude>
                    </excludes>
                </resource>
            </resources>
        </configuration>
    </execution>
</executions>

In this example I tried to exclude the folder "p2".

<exclude>*/p2/**</exclude>
<exclude>p2/**</exclude>
<exclude>**/p2</exclude>

Also don't work.

Answer

Fares Droubi picture Fares Droubi · Aug 18, 2016

<exclude>**/p2/**</exclude>

is the correct answer thanks to @khmarbaise.