Ignore non-file scheme URIs when finding project.
This commit is contained in:
@@ -7,8 +7,8 @@ import org.springframework.ide.vscode.commons.util.Log;
|
||||
public class DefaultJavaProjectFinder implements JavaProjectFinder {
|
||||
|
||||
private final IJavaProjectFinderStrategy[] STRATEGIES = new IJavaProjectFinderStrategy[] {
|
||||
new JavaProjectWithClasspathFileFinderStrategy(),
|
||||
new MavenProjectFinderStrategy()
|
||||
new MavenProjectFinderStrategy(),
|
||||
new JavaProjectWithClasspathFileFinderStrategy()
|
||||
};
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,12 +35,14 @@ public class JavaProjectWithClasspathFileFinderStrategy implements IJavaProjectF
|
||||
URI uri = new URI(uriStr);
|
||||
// TODO: This only work with File uri. Should it work with others
|
||||
// too?
|
||||
File file = toFile(uri);
|
||||
File cpFile = FileUtils.findFile(file, MavenCore.CLASSPATH_TXT);
|
||||
if (cpFile != null) {
|
||||
return cache.get(cpFile, () -> {
|
||||
return new JavaProjectWithClasspathFile(cpFile);
|
||||
});
|
||||
if (uri.getScheme().equalsIgnoreCase("file")) {
|
||||
File file = toFile(uri);
|
||||
File cpFile = FileUtils.findFile(file, MavenCore.CLASSPATH_TXT);
|
||||
if (cpFile != null) {
|
||||
return cache.get(cpFile, () -> {
|
||||
return new JavaProjectWithClasspathFile(cpFile);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -41,12 +41,14 @@ public class MavenProjectFinderStrategy implements IJavaProjectFinderStrategy {
|
||||
URI uri = new URI(uriStr);
|
||||
// TODO: This only work with File uri. Should it work with others
|
||||
// too?
|
||||
File file = new File(uri).getAbsoluteFile();
|
||||
File pomFile = FileUtils.findFile(file, MavenCore.POM_XML);
|
||||
if (pomFile != null) {
|
||||
return cache.get(pomFile, () -> {
|
||||
return new MavenJavaProject(pomFile);
|
||||
});
|
||||
if (uri.getScheme().equalsIgnoreCase("file")) {
|
||||
File file = new File(uri).getAbsoluteFile();
|
||||
File pomFile = FileUtils.findFile(file, MavenCore.POM_XML);
|
||||
if (pomFile != null) {
|
||||
return cache.get(pomFile, () -> {
|
||||
return new MavenJavaProject(pomFile);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user