Maven< include>通配符匹配部分文件夹名称 [英] Maven <include> wildcard match on partial folder name

查看:1249
本文介绍了Maven< include>通配符匹配部分文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用maven-clean-plugin我想删除所有以"tmp"开头的文件夹.这可能带有Maven通配符吗?我已经尝试过:

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>

这不起作用.

推荐答案

此配置对我有用:

<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/

然后mvn clean将删除前两个文件夹,并保留最后一个文件夹.

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

这篇关于Maven&lt; include&gt;通配符匹配部分文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆