Apache Maven Resources Plugin exclude a directory

时间秒杀一切 提交于 2019-12-10 17:39:19

问题


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.


回答1:


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

is the correct answer thanks to @khmarbaise.




回答2:


Try this

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


来源:https://stackoverflow.com/questions/27965578/apache-maven-resources-plugin-exclude-a-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!