"Faceted Project Problem (Java Version Mismatch)" error message
Asked Answered
M

5

72

Eclipse's "problems" tab is displaying this error:

Description: Java compiler level does not match the version of the installed Java project facet.
Resource: groupping
Path: [blank]
Location: Unknown
Type: Faceted Project Problem (Java Version Mismatch)

My pom.xml has this setting:

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

Where else could the settings be mismatched?

Madden answered 10/2, 2010 at 20:4 Comment(0)
H
150

Did you check your Project Properties -> Project Facets panel? (From that post)

A WTP project is composed of multiple units of functionality (known as facets).

The Java facet version needs to always match the java compiler compliance level.
The best way to change java level is to use the Project Facets properties panel as that will update both places at the same time.

WTP

The "Project->Preferences->Project Facets" stores its configuration in this file, "org.eclipse.wst.common.project.facet.core.xml", under the ".settings" directory.

The content might look like this

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <runtime name="WebSphere Application Server v6.1"/>
  <fixed facet="jst.java"/>
  <fixed facet="jst.web"/>
  <installed facet="jst.java" version="5.0"/>
  <installed facet="jst.web" version="2.4"/>
  <installed facet="jsf.ibm" version="7.0"/>
  <installed facet="jsf.base" version="7.0"/>
  <installed facet="web.jstl" version="1.1"/>
</faceted-project>

Check also your Java compliance level:

Java compliance level

Haberman answered 10/2, 2010 at 20:7 Comment(1)
Thanks a lot!It helpedBostwick
T
44

You have two options to fix the issue:

1- Manually make sure the two versions match.
2- Use the IDE's help as follows:
- Right mouse click on the error in the 'Problems' view
- Select the 'Quick Fix' menu item from the pop-up menu
- Select the right compiler level in the provided dialog and click 'Finish'.

Taken from Eclipse: Java compiler level and project facet mismatch

Also gives location of where you can access the Java compiler and facet version.

Thorley answered 10/2, 2010 at 20:8 Comment(0)
E
21

The project facets should be derived automagically by the M2Eclipse plugin from the POM configuration. If you make some changes to the POM and need Eclipse to take them into account, right-click on your project, then go to Maven > Update Project Configuration. You should not set project facets manually.

Eighty answered 10/2, 2010 at 20:40 Comment(2)
@Haberman You're of course right about the way to configure this manually but when using maven and the m2eclipse plugin, the plugin should - and actually does - configure this for you. All the required meta-data are in the POM: JDK level version, Servlet API, etc. Developers don't have to set this manually after an import or any other POM update, which is a good thing. This applies also to the maven-eclipse-plugin (that generates the facet based on the POM meta-data).Eighty
This was probably true when you wrote it, but the latest version of m2e as of 2011-05 doesn't manually add dependencies like the old versions did, so you have to manually convert the project to a faceted project and then manually edit configuration files to get the right jars copied to your lib directory. It's a pain. See sites.google.com/site/michaelvorburger/m2e-and-wtpHeidiheidie
H
0

In Spring STS, Right click the project & select "Open Project", This provision do the necessary action on the background & bring the project back to work space.

Thanks & Regards Vengat Maran

Hathaway answered 9/5, 2016 at 4:12 Comment(0)
R
0

I encountered this issue while running an app on Java 1.6 while I have all three versions of Java 6,7,8 for different apps.I accessed the Navigator View and manually removed the unwanted facet from the facet.core.xml .Clean build and wallah!

<?xml version="1.0" encoding="UTF-8"?>

<fixed facet="jst.java"/>

<fixed facet="jst.web"/>

<installed facet="jst.web" version="2.4"/>

<installed facet="jst.java" version="6.0"/>

<installed facet="jst.utility" version="1.0"/>

Rucksack answered 14/3, 2018 at 11:40 Comment(1)
There is already an accepted answer, that is not only high upvoted but solves OP's issue as well.Micrometer

© 2022 - 2024 — McMap. All rights reserved.