简体   繁体   English

m2Eclipse插件与maven 3.0.3,没有编译错误,jre5与jdk7

[英]m2Eclipse plugin with maven 3.0.3, no compilation errors, and jre5 with jdk7

Question about the m2 eclipse plugin. 关于m2 eclipse插件的问题。 Currently I have "Eclipse Java EE IDE for Web Developers", the most recent update. 目前我有“Eclipse Java EE IDE for Web Developers”,这是最新的更新。 I have the m2 eclipse plugin installed, and have started a normal java project. 我安装了m2 eclipse插件,并启动了一个普通的java项目。 I then converted this to a maven project via 然后我将其转换为maven项目

"right click->configure->convert to to maven project" This appears to work, a pom.xml is created, the project converts, and everything is well and good. “右键单击 - > configure->转换为maven项目”这似乎工作,创建了一个pom.xml,项目转换,一切都很好。

The issue starts when I do anything to this project. 当我对这个项目做任何事情时,问题就开始了。 In the maven settings for the project "Right client on project -> maven" there are several options that are behaving strangely, updating maven configuration will change the default JDK for the project (JDK7) to j2SE-1.5..., which was never installed on the machine, and of course is not found. 在项目的maven设置“项目中的正确客户端 - > maven”中,有几个选项表现得很奇怪,更新maven配置会将项目的默认JDK(JDK7)更改为j2SE-1.5 ...,这是永远的安装在机器上,当然没有找到。 Also code completion, and and error checking is not working in the editor. 代码完成,以及错误检查在编辑器中不起作用。

Example: params.put("some_string", ); 示例:params.put(“some_string”,); This should render "red" for compilation errors because there is no second argument to put(), however this checks out as okay according to the eclipse editor. 这应该为编译错误呈现“红色”,因为put()没有第二个参数,但根据eclipse编辑器,这可以检查出来。

I have some done some research on this issue, and from what I can gather from Google, it appears that there are some issues with m2eclipse and this distro of eclipse however there is nothing to resolve this. 我有一些关于这个问题的研究,从我可以从谷歌那里得到的,看来m2eclipse和eclipse的这个发行版存在一些问题但是没有什么可以解决这个问题。 Is anybody else having similar problems, or does anybody have any idea how to resolve this? 是否有其他人有类似的问题,或者有人知道如何解决这个问题?

Please let me know if the is any other information I can provide, I didn't want to just paste my settings.xml into stack overflow. 如果我能提供任何其他信息,请告诉我,我不想将我的settings.xml粘贴到堆栈溢出中。

Note: I have my settings.xml configured in Eclipse, and have specifies which jdk to use (7) 注意:我在Eclipse中配置了settings.xml,并指定了要使用的jdk(7)

System information: Maven version: 3.0.3 Eclipse Version: Eclipse Java EE IDE for Web Developers Version 系统信息:Maven版本:3.0.3 Eclipse版本:用于Web开发人员的Eclipse Java EE IDE版本

All eclipse plugins have the most recent versions installed as of this post date, and there are no XML integrity errors, or anything of the sort. 所有eclipse插件都具有自此发布日期起安装的最新版本,并且没有XML完整性错误或任何类型的错误。

For the JDK issue: in your pom.xml specify 对于JDK问题:在您的pom.xml中指定

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <showWarnings>true</showWarnings>
    </configuration>
</plugin>

and then do another "Update Project configuration". 然后执行另一个“更新项目配置”。 Then the JDK 7 should be set (at least works for me). 然后应该设置JDK 7(至少对我有用)。

Okay, so the answer to this is the answer to so many other questions on Stack overflow and other sites.... "mvn eclipse:eclipse". 好的,所以对此的答案是关于Stack溢出和其他网站上的许多其他问题的答案....“mvn eclipse:eclipse”。 I was under the impression that Eclipse "did this for you" on project startup, and that is apparently not the case. 在项目启动时,我的印象是Eclipse“为你做了这件事”,显然情况并非如此。 After running that on a brand new work-space after an eclipse re-install (new computer) everything works fine. 在重新安装eclipse(新计算机)之后在一个全新的工作空间运行它之后一切正常。

I felt the need to close this one out. 我觉得有必要关掉这个。 Thanks for the help though. 谢谢你的帮助。

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

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