Environment
- SonarScanner for Gradle:
7.4.0.8496 - SonarScanner for Gradle:
7.3.1.8318(passes) - Gradle:
8.14.5 - Java: Temurin
21.0.12 - A standard single-project Java build
Minimal reproduction
settings.gradle:
rootProject.name = 'sonar-standard-java-repro'
build.gradle:
plugins {
id 'java'
id 'jacoco'
id 'org.sonarqube' version '7.4.0.8496'
}
repositories {
mavenCentral()
}
// Run coverage reporting before analysis so the report exists for Sonar.
tasks.named('sonar') {
dependsOn tasks.withType(JacocoReport)
}
jacocoTestReport {
dependsOn classes
}
Add one Java source file, one Java test source file, and a resource file under src/main/resources.
Run the build and analysis as separate Gradle invocations:
./gradlew clean build
./gradlew sonar
With 7.4.0.8496, the second command fails during sonarResolver, before Sonar analysis starts. The resolver validation can also be isolated without Sonar credentials using:
./gradlew sonarResolver jacocoTestReport
Changing only the plugin version to 7.3.1.8318 makes that isolated command pass.
Failure
Gradle reports an undeclared implicit dependency:
Task ':sonarResolver' uses this output of task ':processResources' without declaring an explicit or implicit dependency.
The failure is raised as org.gradle.internal.execution.WorkValidationException by Gradle task validation.
Expected behavior
sonarResolver should preserve the builtBy task dependencies carried by the source-set classpaths when it exposes them as @Classpath inputs. Mapping the classpath to a plain list of existing Files causes Gradle to lose that provenance and report the false implicit-dependency violation.