简体   繁体   中英

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

Question about the m2 eclipse plugin. Currently I have "Eclipse Java EE IDE for Web Developers", the most recent update. I have the m2 eclipse plugin installed, and have started a normal java project. I then converted this to a maven project via

"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.

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. Also code completion, and and error checking is not working in the editor.

Example: 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.

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. 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.

Note: I have my settings.xml configured in Eclipse, and have specifies which jdk to use (7)

System information: Maven version: 3.0.3 Eclipse Version: Eclipse Java EE IDE for Web Developers Version

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.

For the JDK issue: in your pom.xml specify

<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).

Okay, so the answer to this is the answer to so many other questions on Stack overflow and other sites.... "mvn eclipse:eclipse". I was under the impression that Eclipse "did this for you" on project startup, and that is apparently not the case. After running that on a brand new work-space after an eclipse re-install (new computer) everything works fine.

I felt the need to close this one out. Thanks for the help though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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