-
-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
When using together with the sonarqube plugin, a ClassCastException is thrown:
Caused by: java.lang.ClassCastException: class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class java.lang.String (org.codehaus.groovy.runtime.GStringImpl is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @5fdef03a; java.lang.String is in module java.base of loader 'bootstrap')
at org.sonarqube.gradle.JavaCompilerUtils.configureCompatibilityOptions(JavaCompilerUtils.java:92)
at org.sonarqube.gradle.JavaCompilerUtils.extractConfiguration(JavaCompilerUtils.java:60)
at org.sonarqube.gradle.JavaCompilerUtils.extractJavaCompilerConfigurationFromCompileTasks(JavaCompilerUtils.java:49)
at org.sonarqube.gradle.SonarPropertyComputer.populateJdkProperties(SonarPropertyComputer.java:255)
at org.sonarqube.gradle.SonarPropertyComputer.lambda$configureForJava$3(SonarPropertyComputer.java:220)
at org.gradle.api.internal.collections.CollectionFilter$1.execute(CollectionFilter.java:59)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:161)
at org.gradle.api.internal.DefaultDomainObjectCollection.withType(DefaultDomainObjectCollection.java:203)
at org.sonarqube.gradle.SonarPropertyComputer.configureForJava(SonarPropertyComputer.java:220)
at org.sonarqube.gradle.SonarPropertyComputer.addGradleDefaults(SonarPropertyComputer.java:457)
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:99)
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:146)
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:86)The sonaqube plugin attempts to access the compiler args here, but expects a List<String>.
The mixingradle plugin sets compiler args here using a GString template.
Usually groovy should automatically call toString on them, but for some reason it does not seem to do it here, because the compiler arguments contain objects of type GString when inspected in the debugger.
This can also only be recreated on the first run and can be reproduced by applying both the mixingradle and the sonarqube plugin and running clean build sonar.
A call to toString on all template strings that are appended to the compiler args could solve this problem
Metadata
Metadata
Assignees
Labels
No labels