Maven <include> wildcard match on partial folder name

依然范特西╮ 提交于 2020-01-04 05:57:11

问题


With the maven-clean-plugin I would like to remove all folders that start with "tmp". Is this possbile with maven wildcards? I have tried:

<fileset>
    <directory>${project.basedir}</directory>
    <includes>
        <include>**/tmp*</include>
    </includes>
</fileset>

Which does not work.


回答1:


This configuration works for me:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.5</version>
    <configuration>
        <filesets>
            <fileset>
                <directory>${project.basedir}</directory>
                <includes>
                    <include>**/tmp*/</include>
                </includes>
            </fileset>
        </filesets>
    </configuration>
</plugin>

If I add these folders in the project root:

some/tmp/
some/tmpFolder/
some/realFolder/

Then the mvn clean will delete the first two folders and leave the last one.



来源:https://stackoverflow.com/questions/13288532/maven-include-wildcard-match-on-partial-folder-name

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