运行PIT时从类路径中排除提供的依赖项

时间:2015-01-21 19:01:12

标签: android maven pitest

我想在Android项目中使用PIT(pitest.org)插件。我使用Android Maven插件并拥有相当标准的POM。 Maven包含Android JAR,其中包含提供的范围,包括实际来源,而不是来自SDK的存根JAR。

通过Maven插件从命令行运行PIT失败:

[ERROR] Failed to execute goal org.pitest:pitest-maven:1.1.3:mutationCoverage (default-cli) on project easystat: Executi
on default-cli of goal org.pitest:pitest-maven:1.1.3:mutationCoverage failed: Coverage generation slave exited abnormall
y!
[ERROR]
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : Java HotSpot(TM) 64-Bit Server VM
[ERROR] Vendor : Oracle Corporation
[ERROR] Version : 25.25-b02
[ERROR] Uptime : 3804
[ERROR] Input ->
[ERROR] 1 : -Dclassworlds.conf=C:\Users\Tom\maven\bin\..\bin\m2.conf
[ERROR] 2 : -Dmaven.home=C:\Users\Tom\maven\bin\..
[ERROR] BootClassPathSupported : true
[ERROR]
[ERROR]
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : Java HotSpot(TM) 64-Bit Server VM
[ERROR] Vendor : Oracle Corporation
[ERROR] Version : 25.25-b02
[ERROR] Uptime : 3804
[ERROR] Input ->
[ERROR] 1 : -Dclassworlds.conf=C:\Users\Tom\maven\bin\..\bin\m2.conf
[ERROR] 2 : -Dmaven.home=C:\Users\Tom\maven\bin\..
[ERROR] BootClassPathSupported : true
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.pitest:pitest-maven:1.1.3:mutationCov
erage (default-cli) on project easystat: Execution default-cli of goal org.pitest:pitest-maven:1.1.3:mutationCoverage fa
iled: Coverage generation slave exited abnormally!

Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : Java HotSpot(TM) 64-Bit Server VM
Vendor : Oracle Corporation
Version : 25.25-b02
Uptime : 3804
Input ->
 1 : -Dclassworlds.conf=C:\Users\Tom\maven\bin\..\bin\m2.conf
 2 : -Dmaven.home=C:\Users\Tom\maven\bin\..
BootClassPathSupported : true

之前关于Google网上论坛的一些讨论表明,包含较旧版本的JUnit可能会导致此类错误,并且看起来Android JAR包含3.x JUnit库之一(感谢Android团队......)。为了确认或否认这种预感,我想从PIT的类路径中排除Android JAR,因为我已经在Surefire测试阶段做了,但我没有看到任何选项这样做

有没有办法从PIT中排除提供的依赖项,而不必更改该依赖项的范围?

1 个答案:

答案 0 :(得分:0)

PIT目前没有提供过滤掉依赖关系的方法,它将使用测试范围内项目的所有依赖项。

这将是一个明智的添加功能 - 随意创建一个问题。

您可以通过在类路径/依赖项中的android jar之前放置junit4来解决此问题。