【问题标题】:Maven Surefire Plugin "include" option for Groovy sourcesGroovy 源的 Maven Surefire 插件“包含”选项
【发布时间】:2015-12-16 07:55:27
【问题描述】:

我有 Groovy 项目,我想通过 Surefire 控制要执行的测试 (sample repo)。

假设我有测试 ExampleTest 我可以配置 Surefire 如下:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19</version>
    <configuration>
        <includes>
            <include>**/ExampleTest.*</include>
        </includes>
    </configuration>
</plugin>

我也可以使用&lt;include&gt;ExampleTest.*&lt;/include&gt;&lt;include&gt;ExampleTest&lt;/include&gt;,它可以工作。

很遗憾,我无法将其配置为 &lt;include&gt;ExampleTest.groovy&lt;/include&gt;,但它适用于 &lt;include&gt;ExampleTest.java&lt;/include&gt;

为什么会这样?是bug吗?

【问题讨论】:

    标签: maven groovy maven-surefire-plugin


    【解决方案1】:

    我建议在&lt;include&gt; 模式中使用正则表达式支持,如记录的here

    例如,要包含ExampleTest.groovy 文件:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
                <configuration>
                    <includes>
                        <include>%regex[ExampleTest\.groovy]</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    【讨论】:

      【解决方案2】:

      是的,我们可以说这是一个错误。您不能在包含列表中使用.groovy。但如果你使用.*.java.class,它会起作用。

      【讨论】:

        猜你喜欢
        • 2014-01-07
        • 2018-04-06
        • 1970-01-01
        • 2018-12-20
        • 2018-07-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多