java - "Faceted Project Problem (Java Version Mismatch)"错误信息

标签 java eclipse maven-2 m2eclipse

Eclipse 的“问题”选项卡显示此错误:

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)

我的 pom.xml 有这个设置:

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

还有哪些设置不匹配?

最佳答案

您是否检查了 Project Properties -> Project Facets 面板? (来自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>

还要检查您的Java compliance level :

Java compliance level

关于java - "Faceted Project Problem (Java Version Mismatch)"错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2239959/

相关文章:

java - 如何从 double 中删除尾随零

android - 窗口错误日志在 Eclipse 中不可见

java - 无法在 Maven 项目中创建 servlet

maven-2 - maven - 仅将它用于依赖管理然后让 Ant 做其他所有事情是一种好的/常见的做法吗?

java - Java 8 中的功能类级别参数

java - getResourceAsStream 为 txt 文件返回 null 但对图像有效

java - TableViewer.getElementAt() 返回过滤后的元素

java - 浏览图像文件并使用 Java Swing 显示它

java - 部署maven项目

java - 将 Maven 文件过滤到 WEB-INF