8

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.

kdoteu
  • 1,527
  • 1
  • 20
  • 26

2 Answers2

8

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

is the correct answer thanks to @khmarbaise.

Fares Droubi
  • 332
  • 3
  • 4
  • 7
    Someone trying to farm reputation with the knowledge of others? – Uwe Allner Aug 18 '16 at 09:12
  • 1
    @UweAllner: The answer was in the comments and I just added it, and tagged the source. – Fares Droubi Aug 19 '16 at 14:23
  • You did not add anything of value; not an explanation, additional information or whatever. – Uwe Allner Aug 20 '16 at 06:20
  • 1
    this works but what if you want to exclude only a specific p2 directory not all p2 directories? – raven Nov 21 '17 at 12:10
  • Thank you so much for that answer. This Documentation doesn't really give much detail: http://maven.apache.org/plugins-archives/maven-war-plugin-2.3/examples/adding-filtering-webresources.html – atom88 May 26 '20 at 21:59
2

Try this

<resource>
  <directory>p2</directory>
  <excludes>
      <exclude>p2/**</exclude>
   </excludes>
 </resource>