diff --git a/jps/model/src/org/jetbrains/jps/Module.groovy b/jps/model/src/org/jetbrains/jps/Module.groovy index 2855d40610a7..d6e19d81521f 100644 --- a/jps/model/src/org/jetbrains/jps/Module.groovy +++ b/jps/model/src/org/jetbrains/jps/Module.groovy @@ -73,8 +73,11 @@ class Module extends LazyInitializeableObject implements ClasspathItem {//}, Com excludes = new ArrayList(ownExcludes) Set allContentRoots = project.modules.values().collect { it.contentRoots }.flatten() as Set Set myRoots = contentRoots.collect { new File(it) } as Set - Collection newExcludes = (allContentRoots - contentRoots).findAll { PathUtil.isUnder(myRoots, new File(it)) }.collect { FileUtil.toCanonicalPath(it) } - excludes.addAll(newExcludes) + for (root in allContentRoots) { + if (!(root in contentRoots) && PathUtil.isUnder(myRoots, new File(root))) { + excludes << FileUtil.toCanonicalPath(root) + } + } } return excludes } diff --git a/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy b/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy index 71503e74796b..4c5cc928aeae 100644 --- a/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy +++ b/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy @@ -367,9 +367,13 @@ public class IdeaProjectLoader { imlPaths.each { loadModule(it) } Set allContentRoots = project.modules.values().collect { it.contentRoots }.flatten() as Set project.modules.values().each { module -> - Set myRoots = module.contentRoots.collect { new File(it) } as Set - Collection newExcludes = (allContentRoots - module.contentRoots).findAll { PathUtil.isUnder(myRoots, new File(it)) }.collect { FileUtil.toCanonicalPath(it) } - module.excludes.addAll(newExcludes) + def ownRootPaths = module.contentRoots + Set myRoots = ownRootPaths.collect { new File(it) } as Set + for (root in allContentRoots) { + if (!(root in ownRootPaths) && PathUtil.isUnder(myRoots, new File(root))) { + module.excludes << FileUtil.toCanonicalPath(root) + } + } } }