我试图在父模块的子模块上运行mvn test
,并指定要运行的测试(实际上是1个测试)。
命令:
mvn -pl :tika-parsers test -DfailIfNoTests=false -Dtest=org.apache.tika.detect.TestContainerAwareDetector
问题是由于某种原因,没有测试正在运行。
构建报告:
...
...
...
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ tika-parsers ---
[INFO] Surefire report directory: C:\Users\user\Code\Python\BugMiner\tested_project\tika\tika-parsers\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
... ... ...
我正在运行时:
mvn -pl :tika-parsers test
所有测试都在运行,包括我指定的测试
构建报告:
...
...
...
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ tika-parsers ---
[INFO] Surefire report directory: C:\Users\user\Code\Python\BugMiner\tested_project\tika\tika-parsers\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.tika.detect.TestContainerAwareDetector
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.293 sec
Running org.apache.tika.embedder.ExternalEmbedderTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running org.apache.tika.mime.MimeTypesTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running org.apache.tika.mime.MimeTypeTest
...
...
...
有人可以告诉我什么是正确的命令吗?
答案 0 :(得分:1)
这是肯定的version 2.12 bug。
升级pom.xml
文件中的surefire插件:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
...
</configuration>
</plugin>
答案 1 :(得分:0)
我认为您的命令很好并且可以正常工作,请尝试降级或升级您的surefire版本,这将为您解决问题。