Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization failed. Failed to scan [Project Folder] #1156

Closed
chinloyal opened this issue Nov 21, 2019 · 4 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2905
Closed

Comments

@chinloyal
Copy link

chinloyal commented Nov 21, 2019

The plugin keeps failing when trying to scan a folder in my project it doesn't have access to. Is it possible to exclude folders you don't want to be scanned?

Environment
  • Operating System: "linux", version: "4.19.79-1-manjaro", arch: "amd64", family: "unix"
  • JDK version: 12.0.2
  • Visual Studio Code version: 1.38.1, x64
  • Java extension version: 0.53.1
Steps To Reproduce
  1. Create a folder in your project directory with limited access
  2. Navigate to pom.xml
Current Result
[Error - 11:04:09 AM] Nov 21, 2019, 11:04:09 AM Initialization failed 
Failed to scan /home/chinloyal/Desktop/NBG-Server
org.eclipse.core.runtime.CoreException: Failed to scan /home/user/Desktop/Project-Folder
	at org.eclipse.jdt.ls.core.internal.managers.BasicFileDetector.scan(BasicFileDetector.java:134)
	at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.applies(GradleProjectImporter.java:73)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.getImporter(ProjectsManager.java:427)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:140)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:262)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.nio.file.AccessDeniedException: /home/user/Desktop/Project-Folder/data/mysql
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:432)
	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:474)
	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:300)
	at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:373)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2837)
	at org.eclipse.jdt.ls.core.internal.managers.BasicFileDetector.scanDir(BasicFileDetector.java:168)
	at org.eclipse.jdt.ls.core.internal.managers.BasicFileDetector.scan(BasicFileDetector.java:132)
	... 7 more

Expected Result

Skips data folder which it doesn't have access to and reads the other permissible files.

@snjeza
Copy link
Contributor

snjeza commented Nov 21, 2019

you can try the following:

 "java.import.exclusions": [
        "**/node_modules/**",
        "**/.metadata/**",
        "**/archetype-resources/**",
        "**/META-INF/maven/**",
        "**/NBG-Server/**"
    ]

@chinloyal
Copy link
Author

chinloyal commented Nov 21, 2019

I had already tried that, but to no avail. Same error.

@snjeza
Copy link
Contributor

snjeza commented Nov 21, 2019

"java.import.exclusions": [
        "**/node_modules/**",
        "**/.metadata/**",
        "**/archetype-resources/**",
        "**/META-INF/maven/**",
        "**/NBG-Server/**",
        "**/Project-Folder/**
    ]

@felipebutcher
Copy link

@chinloyal in your case, accordingly to your logs, you have to exclude the folder "data/mysql"

so it should be (in you .vscode/settings.json):

"java.import.exclusions": [
"/data/mysql/*/"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants