Maven <include> wildcard cocok dengan nama folder parsial (Maven <include> wildcard match on partial folder name)


問題描述

Maven wildcard cocok dengan nama folder parsial (Maven wildcard match on partial folder name)

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.

(by S‑K'maba)

參考文件

  1. Maven wildcard match on partial folder name (CC BY‑SA 3.0/4.0)

#maven-3 #maven #wildcard






相關問題

Maven <include> wildcard cocok dengan nama folder parsial (Maven <include> wildcard match on partial folder name)

Eclipse 中使用 MAVEN 3.04 的動態 Web 應用程序 (Dynamic web application in eclipse using MAVEN 3.04)

Множныя рэпазітары Maven3 (Maven3 multiple repos)

замена ўласцівасці архетыпа maven (maven archetype property substitution)

Maven 發布和版本 Maven 插件 (Maven release and versions maven plugin)

Maven-glassfish-plugin:如何指定部署目標? (Maven-glassfish-plugin: how to specify deploy target?)

在 Maven WAR 構建中添加其他類 (Adding Additional classes in maven WAR build)

分佈式 Jenkins - Linux 上的主控和 Windows 上的從屬 - 如何配置節點特定設置 (Distributed Jenkins- Master on Linux and slave on windows- How to configure node specific setting)

如何觸發Maven SCM插件根據現有目錄自動切換目標? (How to trigger Maven SCM plugin to automatically switch goals based on existing directory?)

使用 MongoDB 存儲數據的 Java 應用程序是否需要 Maven? (Is Maven necessary for a Java application that uses MongoDB to store data?)

“el-api”在 pom.xml 中什麼時候有用? (When is "el-api" useful in pom.xml?)

無法在 JDK7 上運行 Maven 3.6.3 (Can't run Maven 3.6.3 on JDK7)







留言討論