3

I have recently upgraded my project from Java 8 to Java 11 alongside Gradle 6.5. However, when I run the command ./gradlew pitest I receive the following error:

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

Here is my pitest set-up in my build.gradle:

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   
}

and here are my pitest related dependencies:

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

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

I am not sure where this mainClass property is coming from and have not found any related answers or documentation on this issue.

Oozeerally
  • 842
  • 12
  • 24

1 Answers1

2

I was able to resolve my issue by upgrading the dependency versions to:

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

and

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

after increasing the dependency versions, the command ./gradlew pitest was working as normal and the pitests were running fine.

Oozeerally
  • 842
  • 12
  • 24
  • I still have the same problem even with the versions you've specified. Do you have any other recommendations? – spartanhooah Jul 23 '21 at 18:24
  • @spartanhooah perhaps try using the latest available version of the dependencies: https://mvnrepository.com/artifact/info.solidsoft.pitest/info.solidsoft.pitest.gradle.plugin?repo=gradle-plugins – Oozeerally Oct 07 '21 at 08:32