Maven wildcard match on partial folder n

2019-07-13 19:22发布

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条回答
闹够了就滚
2楼-- · 2019-07-13 19:38

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.

查看更多
登录 后发表回答