ArtifactsMap (@NotNull ModelBuilderContext context) { Gradle gradle = context.getGradle(); Map<String, SourceSet> artifactsMap = new HashMap<>(); Map<String, String> sourceSetOutputDirsToArtifactsMap = new HashMap<>(); List<Project> projects = new ArrayList<>(gradle.getRootProject().getAllprojects()); boolean isCompositeBuildsSupported = isIsNewDependencyResolutionApplicable() || GradleVersion.current().getBaseVersion().compareTo(GradleVersion.version("3.1")) >= 0; if (isCompositeBuildsSupported) { projects.addAll(exposeIncludedBuilds(gradle)); } for (Project project : projects) { SourceSetContainer sourceSetContainer = JavaPluginUtil.getSourceSetContainer(project); if (sourceSetContainer == null || sourceSetContainer.isEmpty()) continue; for (SourceSet sourceSet : sourceSetContainer) { Task task = project.getTasks().findByName(sourceSet.getJarTaskName()); if (task instanceof AbstractArchiveTask) { AbstractArchiveTask jarTask = (AbstractArchiveTask)task; File archivePath = getTaskArchiveFile(jarTask); if (archivePath != null) { artifactsMap.put(archivePath.getPath(), sourceSet); if (isIsNewDependencyResolutionApplicable()) { for (File file : sourceSet.getOutput().getClassesDirs().getFiles()) { sourceSetOutputDirsToArtifactsMap.put(file.getPath(), archivePath.getPath()); } File resourcesDir = Objects.requireNonNull(sourceSet.getOutput().getResourcesDir()); sourceSetOutputDirsToArtifactsMap.put(resourcesDir.getPath(), archivePath.getPath()); } } } } } return new ArtifactsMap(artifactsMap, sourceSetOutputDirsToArtifactsMap); }