Skip to content

Commit 057f4c2

Browse files
fix not found element exception
1 parent 87ceb90 commit 057f4c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/sonarqube/gradle/SonarQubePlugin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,17 @@ private static List<File> registerAndConfigureResolverTasks(Project topLevelProj
120120
if (sourceSets == null) {
121121
return null;
122122
}
123-
return sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getCompileClasspath();
123+
var set = sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME);
124+
return set == null ? null : set.getCompileClasspath();
124125
});
125126
task.setCompileClasspath(compile);
126127
Provider<FileCollection> test = target.provider(() -> {
127128
var sourceSets = SonarUtils.getSourceSets(target);
128129
if (sourceSets == null) {
129130
return null;
130131
}
131-
return sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME).getCompileClasspath();
132+
var set = sourceSets.findByName(SourceSet.TEST_SOURCE_SET_NAME);
133+
return set == null ? null : set.getCompileClasspath();
132134
});
133135
task.setTestCompileClasspath(test);
134136

0 commit comments

Comments
 (0)