Set<String> (@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule, @NotNull ExternalProject externalProject) { Set<String> contentsRoots = new LinkedHashSet<>(); final String buildDirPath = FileUtil.toCanonicalPath(externalProject.getBuildDir().getPath()); processSourceSets(resolverCtx, gradleModule, externalProject, ideModule, new SourceSetsProcessor() { @Override public void process(@NotNull DataNode<? extends ModuleData> dataNode, @NotNull ExternalSourceSet sourceSet) { sourceSet.getSources().forEach((key, sourceDirectorySet) -> { ExternalSystemSourceType sourceType = ExternalSystemSourceType.from(key); for (File file : sourceDirectorySet.getSrcDirs()) { String path = FileUtil.toCanonicalPath(file.getPath()); contentsRoots.add(path); ContentRootData ideContentRoot = new ContentRootData(GradleConstants.SYSTEM_ID, path); if (FileUtil.isAncestor(path, buildDirPath, true)) { ideContentRoot.storePath(ExternalSystemSourceType.EXCLUDED, buildDirPath); } ideContentRoot.storePath(sourceType, path); dataNode.createChild(ProjectKeys.CONTENT_ROOT, ideContentRoot); } }); } }); return contentsRoots; }