diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 6051655dedf6..244517146b31 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -576,6 +576,7 @@
+
calcClassRoots() {
+ return getBundledGroovyJarRoots();
+ }
+
+ @NotNull
+ public static List getBundledGroovyJarRoots() {
+ final VirtualFile bundledJar = LocalFileSystem.getInstance().findFileByIoFile(GroovyFacetUtil.getBundledGroovyJar());
+ if (bundledJar != null) {
+ final VirtualFile root = StandardFileSystems.getJarRootForLocalFile(bundledJar);
+ if (root != null) {
+ return Collections.singletonList(root);
+ }
+ }
+ return Collections.emptyList();
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java
index 7d9d1fe16ca5..8544ea7e8c86 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java
@@ -20,9 +20,12 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.ResolveScopeProvider;
import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.NonClasspathDirectoriesScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.List;
+
public class GroovyConsoleResolveScopeProvider extends ResolveScopeProvider {
@Nullable
@@ -30,6 +33,15 @@ public class GroovyConsoleResolveScopeProvider extends ResolveScopeProvider {
public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, Project project) {
final GroovyConsoleStateService projectConsole = GroovyConsoleStateService.getInstance(project);
final Module module = projectConsole.getSelectedModule(file);
- return module == null || module.isDisposed() ? null : GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module);
+ if (module == null || module.isDisposed()) return null;
+
+ final GlobalSearchScope moduleScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module);
+ if (!GroovyConsoleUtil.hasGroovyAll(module)) {
+ final List bundledGroovyJarRoots = GroovyBundledClassFinder.getBundledGroovyJarRoots();
+ if (!bundledGroovyJarRoots.isEmpty()) {
+ return new NonClasspathDirectoriesScope(bundledGroovyJarRoots).uniteWith(moduleScope);
+ }
+ }
+ return moduleScope;
}
}