Eclipse中的Java资源文件夹错误 [英] Java Resources Folder Error In Eclipse

查看:96
本文介绍了Eclipse中的Java资源文件夹错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中导入一个spring maven项目(使用maven插件的helios)
i在终端中构建了项目,一切都OK,eclipse在xml或java类中没有显示错误,但仍显示错误标记在Java资源文件夹,不知道为什么?
任何想法?

解决方案

嗯,这可能是因为有一些文件夹包含被视为源的类文件夹由maven(这就是为什么maven命令行编译工作),但不是这样使用.m2 eclipse插件将您的项目导入到eclipse。



这里有一些事情你可能在eclipse项目的属性中尝试:



,转到java构建路径,选择源,并检查是否添加了所有需要的源代码(作为源文件夹) 。如果有些缺失,只需使用添加源手动添加...按钮



有时,一旦在命令行中执行maven clean,eclipse项目将显示错误因为它不再找到编译的类(它们被maven清理)。在eclipse项目上执行项目 - >清理通常会解决这个问题。

尝试将项目添加到eclipse中作为一个简单的eclipse项目:做一个mvn eclipse:eclipse,然后导入它变成eclipse作为eclipse项目(不是maven项目)


i am importing a spring maven project in eclipse (helios with maven plugin) i built the project in terminal, and everything is ok, and eclipse shows no errors in xml or java classes, but still it shows an error mark on Java Resources Folder, no idea why ? any ideas ?

解决方案

Well, it might just be because there are some folders containing classes which are treated as source folders by maven (that's why the maven command line compile works) but not as such when using .m2 eclipse plugin to import your project into eclipse.

Here's some things you might try:

in the properties of your eclipse project, go to java build path, select sources, and check to see if all needed source fodlers are added (as source folders). If some are missing, just add them manually using add sources... button

Sometimes, once you do a maven clean in the command line, the eclipse project will show errors because it no longer finds the compiled classes (they were cleaned by maven). Doing a Project-> clean on your eclipse project usually solves this

Try adding the project into eclipse as a plain ole eclipse project: do a mvn eclipse:eclipse, then import it into eclipse as eclipse project (not maven project)

这篇关于Eclipse中的Java资源文件夹错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆