在eclipse中运行的maven项目的问题,不被认可为Java项目 [英] Issues with maven project running in eclipse, not recognized as Java project

查看:171
本文介绍了在eclipse中运行的maven项目的问题,不被认可为Java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将现有的maven项目导入到Eclipse中。我试图设置一个JUnit测试的配置,我的项目不会作为一个可测试的项目。当我手动输入项目名称时,我收到了消息:


指定的项目不是一个java项目


我也注意到,当输入代码并尝试调用方法System.out会在我输入期间弹出一个消息,说:


这个编译单元不在一个Java项目


此外,当我右键单击项目并导航到构建路径时,没有可用的操作。



在这里和其他地方查看完毕后,我已经遵循以下建议,没有成功:



我已经验证存在.project和.classpath文件



我查看了.project文件,并验证了包含javanature



我已经运行mvn eclipse:eclipse



我右键单击PackageExplorer> Maven>更新项目配置

$中的项目b
$ b

Java不被列为项目方面,但我不知道我应该弄清楚,因为我尝试点击,这导致整个项目被填满错误(I认为建设路径相关,但我不能记得)。删除Java作为一个方面没有摆脱错误,我不得不从头开始重新导入项目。



对不起,如果这是任何模糊的,谢谢帮助。



我正在使用m2eclipse。



编辑:问题只是通过删除项目来解决从我的工作区,删除所有.project,.classpath文件和.settings文件夹,并重新导入。我不知道为什么它第一次不起作用。

解决方案

问题只是通过从我的工作区,删除所有.project,.classpath文件和.settings文件夹,并重新导入。我不知道为什么它第一次没有工作。感谢大家的帮助。


I've imported an existing maven project into Eclipse. I tried to set up the configurations for a JUnit test, and my project wouldn't come up as a testable project. When I typed in the project name manually, I was given the message:

Specified project is not a java project

I've also noticed that when typing code and trying to call a method e.g. "System.out" a message pops up when I type the period, saying:

This compilation unit is not on the build path of a java project

Additionally, there are no actions available when I right click the project and navigate to Build Path.

Having looked this up on here and elsewhere, I've followed the following pieces of advice, without success:

I've verified the existence of .project and .classpath files

I've looked in the .project file and verified the inclusion of a javanature

I've run mvn eclipse:eclipse

I've right-clicked the project in the PackageExplorer > Maven > Update Project Configuration

Java is not listed as a project facet but I'm not sure I should mess with that because I've tried clicking that, and that caused the entire project to be filled with errors (I think related to build path, but I can't quite remember). Removing Java as a facet didn't get rid of the errors and I had to re-import the project from scratch.

Sorry if any of this is vague, and thanks for the help.

I'm using m2eclipse.

EDIT: Problem was solved simply by deleting the project from my workspace, deleting all .project, .classpath files and .settings folders, and re-importing. I don't know why it didn't work the first time.

解决方案

Problem was solved simply by deleting the project from my workspace, deleting all .project, .classpath files and .settings folders, and re-importing. I don't know why it didn't work the first time. Thanks for the help, everyone.

这篇关于在eclipse中运行的maven项目的问题,不被认可为Java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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