【问题标题】:PITest Issue: property 'mainClass' is final and cannot be changed any furtherPITest 问题:属性“mainClass”是最终的,无法进一步更改
【发布时间】:2020-06-11 11:53:37
【问题描述】:

我最近将我的项目从Java 8 升级到Java 11 以及Gradle 6.5。 但是,当我运行命令 ./gradlew pitest 时,我收到以下错误:

Execution failed for task ':pitest'.
> The value for task ':pitest' property 'mainClass' is final and cannot be changed any further.

这是我在build.gradle 中的pitest 设置:

pitest {
    pitestVersion = '1.4.3'
    targetClasses = ['com.myproject.*']
    excludedClasses = [
            'com.myproject.configuration.*',
            'com.myproject.controller.*',
    ]
    threads = 10
    enableDefaultIncrementalAnalysis = true
    historyInputLocation = ['build/reports/pitest/fastermutationtesting']
    historyOutputLocation = ['build/reports/pitest/fastermutationtestingoutput']
    outputFormats = ['XML', 'HTML']
    timestampedReports = true
    mutationThreshold = 90   
}

这是我的 pitest 相关依赖项:

Plugins{
       id "info.solidsoft.pitest" version '1.3.0'
}

testCompile 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.3.0'

我不确定这个 mainClass 属性来自哪里,也没有找到任何关于这个问题的相关答案或文档。

【问题讨论】:

    标签: java gradle pitest


    【解决方案1】:

    我能够通过将依赖项版本升级到来解决我的问题:

    id "info.solidsoft.pitest" version '1.5.1'
    

    testCompile 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.0'
    

    增加依赖版本后,./gradlew pitest 命令正常运行,pitests 运行正常。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-06-12
    • 2020-04-28
    • 2018-12-31
    • 2021-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-08
    相关资源
    最近更新 更多