String (final Module module) { if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module)) return null; final String externalProjectId = ExternalSystemApiUtil.getExternalProjectId(module); if (externalProjectId == null) return null; final String moduleType = ExternalSystemApiUtil.getExternalModuleType(module); boolean trimSourceSet = GradleConstants.GRADLE_SOURCE_SET_MODULE_TYPE_KEY.equals(moduleType); List<String> pathParts = StringUtil.split(externalProjectId, ":"); if (!externalProjectId.startsWith(":") && !pathParts.isEmpty()) { pathParts = pathParts.subList(1, pathParts.size()); } if (trimSourceSet && !pathParts.isEmpty()) { pathParts = pathParts.subList(0, pathParts.size() - 1); } String join = StringUtil.join(pathParts, ":"); return join.isEmpty() ? ":" : ":" + join; }