【发布时间】:2018-01-08 10:59:50
【问题描述】:
在运行mvn test 时,似乎surefire 没有执行它的测试目标(或者至少没有选择我在配置中包含的测试。
这是一个多模块的maven项目,目前都是groovy,结构类似如下:
root
-commons
-framework
-generatedsources1
-generatedsources2
-test-groups
--test-group1
---src/test/java/path.to.TestClass.groovy
--test-group2
我在test-groups pom.xml 中有以下肯定配置:
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Spec.groovy</include>
<include>**/*Test.groovy</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
但是,当我对这个 pom.xml 或任何一个子 pom 执行 mvn test 时,测试阶段永远不会执行。
这是 Maven 输出:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building system-test-category-man 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gmavenplus-plugin:1.6:compile (default) @ system-test-category-man ---
[INFO] Using Groovy 2.4.9 to perform compile.
[INFO] Compiled 2 files.
[INFO]
[INFO] --- gmavenplus-plugin:1.6:compileTests (default) @ system-test-category-man ---
[INFO] Using Groovy 2.4.9 to perform compileTests.
[INFO] Compiled 3 files.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.809 s
[INFO] Finished at: 2018-01-08T10:53:29Z
[INFO] Final Memory: 20M/175M
[INFO] ------------------------------------------------------------------------
当我直接调用插件时:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building system-test-category-man 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-cli) @ system-test-category-man ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.315 s
[INFO] Finished at: 2018-01-08T10:58:18Z
[INFO] Final Memory: 9M/155M
[INFO] ------------------------------------------------------------------------
我是否配置错误?
【问题讨论】:
-
你能发布完整的 pom 吗?
标签: java maven unit-testing groovy maven-surefire-plugin