Java eclipse中无法解析导入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21527653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 09:11:10  来源:igfitidea点击:

The import cannot be resolved in eclipse

javaeclipse

提问by sunleo

Though I have all my source in proper packages.It couldn't find at the time of Building Project.Normally it shows links everything.But at the time of Build Project or Autobuild while directly running project.

虽然我的所有源代码都在适当的包中。在构建项目时找不到。通常它会显示所有链接。但是在构建项目或自动构建时直接运行项目。

The import ecnet.rd.config cannot be resolved 

like it shows for all the internal imports.But external imports like imports from JAR files are working.

就像它显示的所有内部导入一样。但是像从 JAR 文件导入这样的外部导入正在工作。

P.S :

附注:

My Eclipse latestly crashed but it was working well after that, Once again this kind of things are happening.

我的 Eclipse 最近崩溃了,但在那之后运行良好,再一次发生了这种事情。

Please help to find the way to solve this.

请帮助找到解决此问题的方法。

采纳答案by m0skit0

In my experience, it is usual with Eclipse to have the build messed up. Make sure Build automaticallyis checked and Clean. If it doesn't work, restart Eclipse and do again.

根据我的经验,Eclipse 通常会搞砸构建。确保Build automatically已检查和Clean。如果它不起作用,请重新启动 Eclipse 并再次执行。

Also as Tech Junkie comments below, try also Clean all projects.

同样作为技术瘾君子在下面评论,也尝试Clean all projects

回答by Mihai Morcov

After hours of struggle, creating a new Eclipse workspace, reimporting the projects and resetting up the same tomcat instance worked.

经过数小时的努力,创建一个新的 Eclipse 工作区,重新导入项目并重新设置相同的 tomcat 实例。

Probably the eclipse settings got messed up, and the deploy wasn't being done correctly anymore.

可能 eclipse 设置搞砸了,并且部署不再正确完成。

回答by George

I've seen this happen and another approach to take which is similar to m0skit0 solution (if you are using Eclipse) is to right clickon the project, select maven, select update project, make sure clean projectsand refresh workspaceare checked, and hit ok.

我已经看到这种情况发生,另一种类似于 m0skit0 解决方案(如果您使用的是 Eclipse)的方法是right click在项目上,选择maven,选择update project,确保clean projects并被refresh workspace选中,然后点击ok