void () { VirtualFile m1 = createModulePom("m1", """ <groupId>test</groupId> <artifactId>m1</artifactId> <version>1</version> <dependencies> <dependency> <groupId>test</groupId> <artifactId>m2</artifactId> <version>1</version> </dependency> </dependencies> """); VirtualFile m2 = createModulePom("m2", """ <groupId>test</groupId> <artifactId>m2</artifactId> <version>1</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.0</version> <scope>provided</scope> </dependency> </dependencies> """); importProjects(m1, m2); assertModules("m1", "m2"); Module m1m = ModuleManager.getInstance(myProject).findModuleByName("m1"); List<OrderEntry> modules1 = new ArrayList<>(); ModuleRootManager.getInstance(m1m).orderEntries().withoutSdk().withoutModuleSourceEntries().forEach( new CommonProcessors.CollectProcessor<>(modules1)); GlobalSearchScope scope1 = LibraryScopeCache.getInstance(myProject).getLibraryScope(modules1); assertSearchScope(scope1, getProjectPath() + "/m1/src/main/java", getProjectPath() + "/m1/src/test/java", getProjectPath() + "/m2/src/main/java", getProjectPath() + "/m2/src/test/java" ); String libraryPath = getRepositoryPath() + "/junit/junit/4.0/junit-4.0.jar"; String librarySrcPath = getRepositoryPath() + "/junit/junit/4.0/junit-4.0-sources.jar"; Module m2m = ModuleManager.getInstance(myProject).findModuleByName("m2"); List<OrderEntry> modules2 = new ArrayList<>(); ModuleRootManager.getInstance(m2m).orderEntries().withoutSdk().withoutModuleSourceEntries().forEach( new CommonProcessors.CollectProcessor<>(modules2)); GlobalSearchScope scope2 = LibraryScopeCache.getInstance(myProject).getLibraryScope(modules2); List<String> expectedPaths = new ArrayList<>(List.of(getProjectPath() + "/m2/src/main/java", getProjectPath() + "/m2/src/test/java", libraryPath)); if (new File(librarySrcPath).exists()) { expectedPaths.add(librarySrcPath); } assertSearchScope(scope2, ArrayUtilRt.toStringArray(expectedPaths)); }