• Register
1 vote
85 views

Problem:

Dear all, Right now I’ve imported a maven project into my eclipse IDE and I changed my java path library to work on java 1.7

Suddenly, eclipse started showing an error but I’ve got no errors in my files there. The error is java compiler level does not match the version of the installed Java project facet

Java compiler level does not match the version of the installed Java project facet.
Unknown Faceted Project Problem (Java Version Mismatch)

Please tell me how to resolve this error (I want to have my JRE version as 1.7 only).

12 7 7
15,250 points

2 Answers

1 vote

Solution:

All you need to change the Java facet version from 1.x to 1.7 (as you said, you want stick-on version 1.7)

Find the project properties and set your java project version to 1.7 using the above screenshot. 

The other possible solution could be the editing of the project settings for facets. Find the .settings folder in your root. Inside the folder, you’ll have a file named: org.eclipse.wst.common.project.facet.core.xml 

The original file is (imaginary):

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="2.3"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.5"/>
</faceted-project>

Let’s modify it and set the java version to 1.7

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="2.3"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.7"/>
</faceted-project>

Refresh the project. Now, it should run fine. Thanks.

13 9 6
94,240 points
0 votes

Solution:

Considering that you are employing the m2e plugin in Eclipse, you'll require to seclude the source and target versions as 1.6 for maven-compiler-plugin. m2e uses these values to determine the project's Java compiler level. A snippet of the POM is displayed below:

<build>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
    </plugin>
  </plugins>
</build

Possibly, you can seclude the maven.compiler.source and maven.compiler.target properties with values of 1.6, that occur to be the equivalent:

<properties>
    <maven.compiler.target>1.6</maven.compiler.target>
    <maven.compiler.source>1.6</maven.compiler.source>
</properties>

In case your project is not a Maven project, right-click on your project and choose Properties to open the Project Properties dialog.

There is a Project Facets item on the left, choose it, search for the Java facet on the list, choose which version you want to use for the project and employ.

TK Gospodinov answer is right even for maven projects. Look out: I do use Maven. The pom was right and still got this problem. I went to "Project Facets" and really removed the Java selection which was pointing to 1.6 however my project is employing 1.7. On the right in the "Runtimes" tab I had to check the jdk1.7 option. Nothing present on the left even after I hit "Apply". The problem went away though which is why I still consider this answer is significant of the earmarked "Project Facets" related issue. Afterwards you hit OK in case you come back to "Project Facets" you will observe Java displays up as version 1.7 hence you can now choose it to ensure that the project is "marked" as a Java project. I also necessary to right click on the project and choose Maven|Update Project.

I altered the configuration inside

workspace/project/.setting/org.eclipse.wst.common.project.facet.core to :
installed facet="jst.web" version="2.5"
installed facet="jst.java" version="1.7"

Before altering config, remove project from IDE. This performed for me.

For solving this problem, you require to make one time update in your pom.xml file. This update is for overriding the default compiler level in maven compiler plugin.

<plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
    </plugin>
</plugins>

Update above compiler properties with your desired java version. And set this configuration within “build” node in pom.xml file :

<build>
    <finalName>JerseyHelloWorld</finalName>
    <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
        </plugin>
  </plugins>
</build>

 

10 6 4
31,120 points

Related questions

0 votes
1 answer 10 views
10 views
Problem: I am trying to load Java Web App into the Eclipse (via the Import Maven Project) but I am facing below error which says: "Cannot change version of project facet Dynamic Web Module to 2.5". I am trying to do research on the above error and one thing I ... >  <installed facet="wst.jsdt.web" version="1.0"/> </faceted-project> Can someone help me in fixing above project facet related error.
asked Jul 7 Raphael Pacheco 4.9k points
0 votes
0 answers 11 views
11 views
Problem: I have fundamental knowledge of Java and Maven. I am currently using the maven to create the dynamic webapp in a Eclipse IDE. I have already added some folders like src/test/java and src/test/resources. Also I have changed a library in a Java Build ... change version of project facet Dynamic Web Module to 3.1. I have already changed everything that would affect the changing I guess so.
asked Jun 16 Raphael Pacheco 4.9k points
1 vote
1 answer 137 views
137 views
Problem: Hello Guys, I am trying to import a Maven project in my Eclipse IDE but the project is not importing properly. It shows an error, source folder is not a java project when I m trying to give it a new call-in it. The problem is literally going over my head ... the problem, as well as have a solution, please speak up. I'm surfing over the internet for an hour but couldn&rsquo;t fix this yet.
asked Apr 2 Gavin 15.3k points
0 votes
1 answer 41 views
41 views
Problem : I created a project by Maven integration in Eclipse , but in the work space in all JSP files have bellow message: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
asked Oct 31, 2019 peterlaw 6.9k points
0 votes
2 answers 76 views
76 views
Problem : I want to compile a project in Eclipse using the m2eclipse. I set my JDK path in Eclipse as below: Windows-->preferences-->installed jres--> jdk1.7.xx path But this is showing me below error [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ ... BUILD FAILURE [INFO] ------------------------------------------------------------------------
asked Feb 4 jwilliam 3.9k points