Java compiler level does not match the version of the installed Java project facet

后端 未结 12 1661
不知归路
不知归路 2020-12-07 07:19

I have created a New Dynamic Project under Eclipse Helios Version, where my JRE Version is set to 1.6. I have added Maven capabilities to the Web Application by clicking on

相关标签:
12条回答
  • 2020-12-07 08:04

    The Project Facet->Java should match whatever you have in the pom.xml for the maven-compiler-plugin artifact source and target.This is perfect.But if you donot have it here then you can also fix it by matching Java compiler version in Porject-Facets from the setting: Eclispe->Preferences->Java->Compiler

    0 讨论(0)
  • 2020-12-07 08:07

    I changed 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 changing config, remove project from IDE. This worked for me.

    0 讨论(0)
  • 2020-12-07 08:08

    Right click the project and select properties Click the java compiler from the left and change to your required version Hope this helps

    0 讨论(0)
  • 2020-12-07 08:10

    In Eclipse, right click on your project, go to Maven> Update projetc. Wait and the error will disappear. This is already configured correctly the version of Java for this project.

    enter image description here

    0 讨论(0)
  • 2020-12-07 08:12

    Assuming that you are using the m2e plugin in Eclipse, you'll need to specify 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 shown below:

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

    Alternatively, you can specify the maven.compiler.source and maven.compiler.target properties with values of 1.6, that happen to be the equivalent:

    <properties>
        <maven.compiler.target>1.6</maven.compiler.target>
        <maven.compiler.source>1.6</maven.compiler.source>
    </properties>
    
    0 讨论(0)
  • 2020-12-07 08:12

    You can change project facet from Project --> Properties --> Project Facet --> Java --> {required JDK version}

    0 讨论(0)
提交回复
热议问题