是否可以使用通配符逻辑“*”通过 Apache Maven 目标和选项列出特定目录?

Is it possible to use wildcard logic '*' to list a specific directory via Apache Maven Goals & Options?

我需要在我的 Maven 目标和选项命令中使用通配符逻辑列出特定目录。

目前根目录是: mvn test -Dcucumber.options="C:/Users/Joe_Blogs/Desktop/AutoFramework/src/test/resources/features/Bookings/MakeBooking.feature"

我需要使用 ** 扫描项目文件夹以搜索给定的功能文件,因为文件夹名称 (Bookings) 可能会更改。 mvn test -Dcucumber.options="C:/Users/Joe_Blogs/Desktop/AutoFramework/src/test/resources/features/**/MakeBooking.feature"

在上面的示例中 ** 需要引用各种不同的文件夹,而不仅仅是 Bookings。

有什么想法吗?

感谢您的帮助。

Maven 支持 "any" 和 "any descendant" 通配符,分别表示为 ***。它是 <fileset> Ant convention.

的子集

支持来自Apache Maven Shared Utils library. The actual logic of walking directory trees, path normalization, pattern matching, etc. is grouped inside the org.apache.maven.shared.utils.io package. Those classes provides uniform file system handling across plugins supported by the the Maven Project.

如参考资料所示,通配符处理既不是微不足道的逻辑,也不是在 Maven 本身之外神奇地应用的。 Cucumber 必须以某种方式有意支持语法。抱歉,Cucumber 似乎不支持 "any descendant" 通配符。最接近的等效项是路径末尾的 /*

但是,一种可能的解决方法是使用 tags。标记单个文件可能看起来很愚蠢,但这样做可以消除对路径的任何担忧。示例:

mvn test -Dcucumber.options="--tags @MakeBooking"