简体   繁体   English

Vs Code java 导入无法解析

[英]Vs Code java The import cannot be resolved

I recently moved from windows 10 to Ubuntu 16.04, I'm a java developer, when I was on windows I installed Vs Code with the java Extension pack.我最近从 Windows 10 转移到 Ubuntu 16.04,我是一名 Java 开发人员,当我在 Windows 上时,我安装了带有 Java 扩展包的 Vs Code。 On windows I never Had problem to make my daily work, but on ubuntu, every java file is marked as error, with the message " The import cannot be resolved ", searching a litle bit, i found that you can execute the command java:clean the java language server workspace , but this does not fix the problem.在 Windows 上,我的日常工作从来没有遇到过问题,但是在 ubuntu 上,每个 java 文件都被标记为错误,并显示消息“无法解析导入”,搜索了一下,我发现您可以执行命令java:清理 java 语言服务器工作区,但这并不能解决问题。 I also remove the tmp files from the workspace located on:我还从位于以下位置的工作区中删除了 tmp 文件:

~/.config/Code/User/workspaceStorage ~/.config/Code/User/workspaceStorage

  • the current Version of Vs code is 1.41.1当前版本的 Vs 代码是 1.41.1

  • the current version of Java Extension Pack is 0.8.1 Java 扩展包的当前版本是 0.8.1

Any ideas?.有任何想法吗?。

Regards!.问候!。

Edit: all my java files are marked as error编辑:我所有的 java 文件都被标记为错误

inside of every java file在每个java文件里面

this is the result of the maven-install这是 maven-install 的结果

well, after a while of searching, I found that the "maven for java" plugin was trying to download the maven plugin maven-metadata.xml , which wasn't available on my repo.好吧,经过一段时间的搜索,我发现“maven for java”插件正在尝试下载 maven 插件maven-metadata.xml ,这在我的仓库中不可用。 this caused a conflict with the initial build that maven for java was doing.这导致与 maven for java 正在做的初始构建发生冲突。 to avoid to update every time I opened vs code, I removed the option "update snapshots"为避免每次打开 vs 代码时更新,我删除了“更新快照”选项

VSCode 配置截图

And the initial build was done.并且完成了最初的构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM