szpak/gradle-pitest-plugin

JDK-8 support

holgerstolzenberg opened this issue · 19 comments

Hey,

I am using the gradle-pitest-plugin under JDK-8 with Gradle-1.11. Here is my declaration from build.gradle:

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'org.springframework.boot:spring-boot-gradle-plugin:' + springBootVersion
    classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:0.32.0'
  }
}

pitest {
  //dependencies {
  //  compile 'org.ow2.asm:asm:5.0'
  //}

  pitestVersion = "0.33"
}

The test execution fails with the following exception:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':dashboard-server:pitest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:46)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.Main.main(Main.java:37)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.IllegalArgumentException
    at org.pitest.reloc.asm.ClassReader.<init>(Unknown Source)
    at org.pitest.reloc.asm.ClassReader.<init>(Unknown Source)
    at org.pitest.classinfo.ClassInfoVisitor.getClassInfo(ClassInfoVisitor.java:39)
    at org.pitest.classinfo.Repository.nameToClassInfo(Repository.java:69)
    at org.pitest.classinfo.Repository.fetchClass(Repository.java:59)
    at org.pitest.classinfo.NameToClassInfo.apply(NameToClassInfo.java:15)
    at org.pitest.classinfo.NameToClassInfo.apply(NameToClassInfo.java:6)
    at org.pitest.functional.FCollection.flatMapTo(FCollection.java:56)
    at org.pitest.functional.FCollection.flatMap(FCollection.java:66)
    at org.pitest.classpath.CodeSource.getCode(CodeSource.java:46)
    at org.pitest.mutationtest.verify.DefaultBuildVerifier.verify(DefaultBuildVerifier.java:31)
    at org.pitest.mutationtest.tooling.MutationCoverage.verifyBuildSuitableForMutationTesting(MutationCoverage.java:212)
    at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:116)
    at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:100)
    at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:42)
    at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:69)
    at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:41)
    at org.pitest.mutationtest.commandline.MutationCoverageReport$main.call(Unknown Source)
    at info.solidsoft.gradle.pitest.PitestTask.run(PitestTask.groovy:172)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 43 more

I already read some blog posts and it seems like this problem relates to an invalid ASM library. I tried to declare a dependency directly to the pitest task but that does not help. On my default class path there is an ASM library version 3.3.1 because of a transitive dependency of QueryDSL.

pitest - The Pitest libraries to be used for this project.
\--- org.pitest:pitest-command-line:0.33
     \--- org.pitest:pitest:0.33
          +--- junit:junit:4.10
          |    \--- org.hamcrest:hamcrest-core:1.1
          \--- org.testng:testng:6.1.1
               +--- junit:junit:3.8.1 -> 4.10 (*)
               +--- org.beanshell:bsh:2.0b4
               +--- com.beust:jcommander:1.12
               \--- org.yaml:snakeyaml:1.6

I noticed that the 'pitest' classpath does not include a specific ASM version.

Any advice would be pretty much appreciated.

Thanks for the report!

The problem is in fact with old asm version, but PIT has embedded (and relocated) asm version (see package in a stacktrace at org.pitest.reloc.asm.ClassReader.<init>(Unknown Source)) and as of 0.33 this is 5.0_BETA (which supports Java 8 bytecode). It took me awhile to get know what is the reason (I was focused on the old asm version in PIT, but it was perfectly fine).

The problem is that a mechanism in the plugin which allows to change default PIT version doesn't work properly and even though it passes to PIT good (overridden) version the default version do the plugin is used. For 0.32.0 it was 0.32 which doesn't support Java 8 bytecode (has old embedded asm).

As a workaround I uploaded gradle-pitest-plugin 0.33.0-SNAPSHOT (available in Sonatype snapshot repository) which fixes your problem (by using 0.33 as a default version). I will release 0.33.0 when I fix the core problem with dependencies.

Btw, I tested the plugin with Java 8 before 0.33 was released, but I was using the new snapshot version which had PIT 0.33 set as a default version :).

Thanks for your reply.

I just tested against the SNAPSHOT version of the plugin and everything works fine! Good work so far. As I am using this for production code, when do you think will 0.33.0 plugin be released?

There is a problem with the classpath which is used to call a static bootstraping method in PIT from my plugin and a classpath which PIT uses to set up its deamons/workers. It is possible to use PIT 0.33 with gradle-pitest-plugin 0.32.0 with the following configuration:

buildscript {
    (...)
    dependencies {
        classpath('info.solidsoft.gradle.pitest:gradle-pitest-plugin:0.32.0') {
            exclude(group: 'org.pitest')
        }
        classpath 'org.pitest:pitest-command-line:0.33'
    }
}

pitest {
    pitestVersion = "0.33"
}

but I would like to allow user to just define requested version in pitestVersion parameter (which is something I am working on, but currently only with various problems and I'm not sure if it would be possible without writing a custom class loader to bootstrap PIT...).

I have tried your workaround, and the build succeeds, but now I am getting an exception during the test run. That did not happen with the SNAPSHOT plugin version. I am also wondering why the build does not break. I will provide the stack trace for further analysis. For the moment, I will fallback to the SNAPSHOT plugin.

11:05:22 AM PIT >> INFO : Verbose logging is disabled. If you encounter an problem please enable it before reporting an issue.
11:05:22 AM PIT >> INFO : SLAVE : objc[13216]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. 
11:05:22 AM PIT >> INFO : SLAVE : Which one is undefined.

11:05:22 AM PIT >> INFO : Sending 21 test classes to slave
11:05:22 AM PIT >> INFO : Sent tests to slave
11:05:22 AM PIT >> INFO : SLAVE : 11:05:22 AM PIT >> SEVERE : Error calculating coverage. Process will exit.
org.pitest.reloc.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.pitest.junit.JUnitCompatibleConfiguration.config
---- Debugging i
11:05:22 AM PIT >> INFO : SLAVE : nformation ----
field               : config
class               : org.pitest.junit.JUnitCompatibleConfiguration
required-type       : org.pitest.junit.JUnitCompatibleConfiguration
converter-type      : org.pitest.reloc.xstream.converters.reflection.Reflec
11:05:22 AM PIT >> INFO : SLAVE : tionConverter
path                : /org.pitest.coverage.execute.CoverageOptions/pitConfig/configs/org.pitest.junit.JUnitCompatibleConfiguration/config
line number         : 1
class[1]            : java.util.ArrayList
converter-type[1]   : org.pitest.reloc
11:05:22 AM PIT >> INFO : SLAVE : .xstream.converters.collections.CollectionConverter
class[2]            : org.pitest.mutationtest.config.CompoundConfiguration
class[3]            : org.pitest.coverage.execute.CoverageOptions
version             : 0.32
-------------------------------
    at 
11:05:22 AM PIT >> INFO : SLAVE : org.pitest.reloc.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:453)
    at org.pitest.reloc.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:294)

11:05:22 AM PIT >> INFO : SLAVE :   at org.pitest.reloc.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234)
    at org.pitest.reloc.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at org.pitest.reloc.xstream.core.AbstractRe
11:05:22 AM PIT >> INFO : SLAVE : ferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at org.pitest.reloc.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at org.pitest.reloc.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at o
11:05:22 AM PIT >> INFO : SLAVE : rg.pitest.reloc.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at org.pitest.reloc.xstream.converters.collections.CollectionConverter.addCurrentElementToCollection(CollectionConverter.java:79)
    at 
11:05:22 AM PIT >> INFO : SLAVE : org.pitest.reloc.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:72)
    at org.pitest.reloc.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:66)
    at org.pitest.reloc
11:05:22 AM PIT >> WARNING : Error while watching child process
java.util.concurrent.ExecutionException: org.pitest.util.PitError: null

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.0-b70
Uptime : 8110
Input -> 
 1 : -Dorg.gradle.appname=gradle
BootClassPathSupported : true

    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.pitest.util.CommunicationThread.waitToFinish(CommunicationThread.java:60)
    at org.pitest.coverage.execute.CoverageProcess.waitToDie(CoverageProcess.java:34)
    at org.pitest.coverage.execute.DefaultCoverageGenerator.gatherCoverageData(DefaultCoverageGenerator.java:127)
    at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:82)
    at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:46)
    at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:118)
    at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:101)
    at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:43)
    at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:71)
    at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:43)
    at org.pitest.mutationtest.commandline.MutationCoverageReport$main.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at info.solidsoft.gradle.pitest.PitestTask.run(PitestTask.groovy:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:46)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.Main.main(Main.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.pitest.util.PitError: null

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.0-b70
Uptime : 8110
Input -> 
 1 : -Dorg.gradle.appname=gradle
BootClassPathSupported : true

    at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:20)
    at org.pitest.util.SafeDataInputStream.readByte(SafeDataInputStream.java:65)
    at org.pitest.util.SocketReadingCallable.receiveResults(SocketReadingCallable.java:63)
    at org.pitest.util.SocketReadingCallable.call(SocketReadingCallable.java:36)
    at org.pitest.util.SocketReadingCallable.call(SocketReadingCallable.java:12)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:267)
    at org.pitest.util.SafeDataInputStream.readByte(SafeDataInputStream.java:63)
    ... 5 more
11:05:22 AM PIT >> INFO : SLAVE : .xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61)
    at org.pitest.reloc.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at org.pitest.reloc.xstream.core.AbstractReferenceUnmarshaller.convert(Abstract
11:05:22 AM PIT >> INFO : Calculated coverage in 0 seconds.
11:05:22 AM PIT >> INFO : Created  25 mutation test units
11:05:23 AM PIT >> INFO : Completed in 1 seconds
/================================================================================
- Timings
================================================================================
> scan classpath : < 1 second
> coverage and dependency analysis : < 1 second
> build mutation tests : < 1 second
> run mutation analysis : < 1 second
--------------------------------------------------------------------------------
> Total  : < 1 second
--------------------------------------------------------------------------------
================================================================================
- Statistics
================================================================================
>> Generated 175 mutations Killed 0 (0%)
>> Ran 0 tests (0 tests per mutation)
================================================================================
- Mutators
================================================================================
> org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator
>> Generated 1 Killed 0 (0%)
> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 
> NO_COVERAGE 1 
--------------------------------------------------------------------------------
> org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator
>> Generated 80 Killed 0 (0%)
> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 
> NO_COVERAGE 80 
--------------------------------------------------------------------------------
> org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator
>> Generated 64 Killed 0 (0%)
> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 
> NO_COVERAGE 64 
--------------------------------------------------------------------------------
> org.pitest.mutationtest.engine.gregor.mutators.MathMutator
>> Generated 2 Killed 0 (0%)
> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 
> NO_COVERAGE 2 
--------------------------------------------------------------------------------
> org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator
>> Generated 28 Killed 0 (0%)
> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 
> NO_COVERAGE 28 
--------------------------------------------------------------------------------

BUILD SUCCESSFUL

Total time: 8.713 secs

Hm, the last comment is not fully correct. I recognised a small miss configuration of my build script. Still, a clean 0.33.0 plugin release is pretty much appreciated :-).

I evaluated a few possible solutions (including Gradle internal classes) and at the end after a consultation with Peter Niederwieser I decided to use JavaExec task which launches PIT as a separate Java process (with a separate classpath) what fixes an ability to override PIT version. There is a new mainProcessJvmArgs parameter, but as PIT itself starts child processes for mutation analysis there usually should be no need to use it (e.g. to increase available memory).
I uploaded a snapshot version 0.33.0-SNAPSHOT. Could you give it a try and tell me if this version work for you out-of-box?

Btw, the another solution would be needed to support EntryPoint and the new extended plugin support in PIT (the would be not more static main method), so maybe when needed there would be implemented the solution with custom classloader - we will see.

Btw, for consistency I changed also jvmArgs configuration parameter type from String to List<String>. This can cause a ClassCastException exception if you already used it in your project. Unfortunately I coudn't find a way to support both String and List<String> as input types for the same parameter.

Hey szpak,

I just tried it and it works so far. Thanks a lot. This is the configuration I am using currently.

ext {
   pitestPluginVersion = "0.33.0-SNAPSHOT"
}

buildscript {
  dependencies {
    classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:" + pitestPluginVersion)
  }
}

pitest {
  threads = 6
}

I am getting some errors printed to the console when running, but the test suite runs through:

stderr  : objc[39759]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. stderr  : Which one is undefined.

From my side, the release can be made.

Okay I have to correct myself. The plugin SNAPSHOT Version breaks mit 'bootRun' task. I have to dig deeper into it to provide some more details on that.

Finally I had to revert back to plugin version 0.32.0. The error that occurred is very weird. With the following configuration, everything works fine, I can execute pitest and bootRun tasks without problems:

buildscript {
  repositories {
    maven { url "https://ci.it.ewerk.com/nexus/content/groups/public" }
  }

  dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:1.0.1.RELEASE"

    classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:0.32.0") {
      exclude group: "org.pitest"
    }
    classpath "org.pitest:pitest-command-line:0.33"
  }
}

Using the following configuration breaks my build:

buildscript {
  repositories {
    maven { url "https://ci.it.ewerk.com/nexus/content/groups/public" }
  }

  dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:1.0.1.RELEASE"

    classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:0.33.0-SNAPSHOT") {
      exclude group: "org.pitest"
    }
    classpath "org.pitest:pitest-command-line:0.33"
  }
}

Executing the pitest tasks still works without problems, but when I execute the bootRun (Spring Boot porject) task, the embedded jetty launches up without problems, but it does not serve static resources any more.

I have no clue if this is a problem of the spring-boot or the pitest plugin. In the end they should not interfere with each other at all. Did I misconfigure something?

Thanks for your feedback and sorry for a late reply. I haven't got any email notification about your last 3 comments...

I tried to reproduce problem you mentioned with Getting Started Spring Boot application, but with no luck. gradle bootRun with both Tomcat and Jetty started fine with pitest applied. Do you have problem only with static resources or you meant "even" static resources (as well as controllers)?

Do you have anything special in your Spring Boot application? Maybe you would be ale to enhance the original sample app to reproduce the problem with bootRun?

Regarding the first error about JavaLaunchHelper what Java version do you use? Could it be that bug?

Regarding the JavaLaunchHelper problem, I think it is the bug you mentioned, but could not verify it right away. I am using the following java version:

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

I think there is no need to follow this one up any more, sorry for mixing the tickets.

To come back to the original issue, yes of course my spring boot app is "special". And yes, the problem is ONLY related to static resources, controllers work as expected. I will give it a shot with the example app and try to enhance it until the problems occurs. I will come back with feedback as soon as possible.

I have put together a example project that shows the issue:

https://github.com/lando/spring-boot-pitest

The problem is described within the buildScript section of build.gradle. I hope this will help finding the issue.

Thanks lando! I will take a look at it tonight.

Please run the project with a JDK-8. Here is my concrete version.

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Your project was really helpful. I tried to run it with openjdk-1.8.0.5 and it fails in more spectacular way :).

:bootRun
2014-04-24 00:35:01.028  INFO 27794 --- [           main] com.company.hello.Application            : Starting Application on emszpak with PID 27794 (/home/foo/spring-boot-pitest/build/classes/main started by szpak)
2014-04-24 00:35:01.079  INFO 27794 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@58a90037: startup date [Thu Apr 24 00:35:01 CEST 2014]; root of context hierarchy
2014-04-24 00:35:02.102  INFO 27794 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$f3bd2b74] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-04-24 00:35:02.135  INFO 27794 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-04-24 00:35:02.148  INFO 27794 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-04-24 00:35:02.153  INFO 27794 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-04-24 00:35:02.176  INFO 27794 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/home/foo/spring-boot-pitest/build/classes/test/, file:/home foo/spring-boot-pitest/build/resources/test, file:/home/foo/spring-boot-pitest/build/classes/main/, file:/home/foo/spring-boot-pitest/build/resources/main/, file:/home/foo/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aspects/4.0.3.RELEASE/e0a8f3dbaffe501cc95f12365ea6751e629237c6/spring-aspects-4.0.3.RELEASE.jar, file:/home/foo/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/4.0.3.RELEASE/5c86b94f15523b3b125c35861aeb4ca85897231a/spring-jdbc-4.0.3.RELEASE.jar,
(...)
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jetty.port' in string value "${jetty.port}"

This helped me to focus on classpath issue and it seems I have found the reason of my situation (which probably causes also your problems). spring-boot-gradle-plugin takes any JavaExec task in the build and tries to execute it. Before the execution the task is modified to support dynamic reloading and some other spring-boot features which causes that pitest task (which in my case was run first on bootRun) tries to setup the Spring context. I reported issue #721 with a solution proposal (I'm not sure what they wanted to achieve).

Unfortunately this makes version 0.33.0 not usable in spring-boot application (at least until they modify their plugin). Luckily PIT 0.33 with a workaround can be used with 0.32.0 which I will add to README.

Thanks for your work. I will watch the spring-boot issue.

As 0.33.0 provides native support for PIT 0.33 and Java 8 I'm closing this issue. I created #11 to keep users informed.