19
votes

First of all, I'm using Ubuntu 12.04, Eclipse Juno with embebbed maven 3.0.4 (m2eclipse) and I have to work in a legacy project which I got from a SVN repositroy.

I'm stuck in a sort of configuration problem with Maven and Eclipse.

At the first time I did a Maven > Update project and I got an "Unknown Error" of "Maven Java EE Configuration Problem" type. I checked my project's properties and I've realized that java compliance level is set to 1.5 but I have 1.6 JRE activated. Well, I've changed to 1.6 version (in Java Facet too), but when I do a Maven > Update project, my project's properties are restored to default (a.k.a. 1.5 version), and the Unknown error persists.

My pom.xml file seems to be ok, and I also try to update project with an empty pom.xml (just with modelVersion, groupId, artifactId, version, name and url tags) and I always get the same error.

I'm really stuck. Someone has a clue?

1
This is a known "feature" of Maven. The default compiler source/target version is 1.5 unless you explicitly specify a version in your POM. The way Maven integration in Eclipse works, it (re)generates your .project, .classpath and .settings from the POM, so unless the POM specifies the correct JDK version, it will get reset to 1.5 every time you update the project configuration. @maximdim's answer below is correct.Jim Garrison
Ok, I was thinking that 1.6 was the default version. This issue is solved but the Maven Java EE Configuration Problem persistsilazgo
Finally I solved my problems deleting .settings folderilazgo

1 Answers

36
votes

Try specifying JDK version in pom.xml:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

and then do 'Update Project Configuration'