“分面项目问题(Java 版本不匹配)”错误信息

发布于 2024-08-20 19:36:28 字数 607 浏览 9 评论 0原文

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

描述:Java 编译器级别与安装的 Java 项目构面的版本不匹配。
资源:分组
路径:[空白]
地点:未知
类型:分面项目问题(Java 版本不匹配)

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

还有哪些设置可能不匹配?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

迷路的信 2024-08-27 19:36:28

您检查过您的项目属性 -> 吗?项目 Facets 面板? (摘自该帖子

WTP 项目由多个功能单元组成(称为
方面)。

Java Facet 版本需要始终与 Java 编译器合规性相匹配
水平。
更改 java 级别的最佳方法是使用 Project Facets
属性面板,因为这将同时更新两个位置。

WTP

Project->Preferences->Project Facets”将其配置存储在此文件“org.eclipse.wst.common.project.facet.core.xml< /code>”,位于“.settings”目录下。

内容可能如下所示

<?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 合规性级别

Java 合规级别

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

哽咽笑 2024-08-27 19:36:28

您有两种选择来解决此问题:

1- 手动确保两个版本匹配。
2- 使用IDE的帮助如下:
- 在“问题”视图中右键单击错误
- 从弹出菜单中选择“快速修复”菜单项
- 在提供的对话框中选择正确的编译器级别,然后单击“完成”。

取自Eclipse:Java 编译器级别和项目构面不匹配

还提供了可以访问 Java 编译器和构面版本的位置。

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.

菊凝晚露 2024-08-27 19:36:28

项目方面应该由 M2Eclipse 插件从 POM 配置自动派生。如果您对 POM 进行了一些更改并且需要 Eclipse 考虑这些更改,请在您的项目上右键单击,然后转到 Maven >更新项目配置。您不应手动设置项目方面。

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.

梦罢 2024-08-27 19:36:28

在 Spring STS 中,右键单击项目并选择选择“打开项目”,此选项在后台执行必要的操作将项目带回工作空间。

谢谢&问候
文加特·马兰

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

究竟谁懂我的在乎 2024-08-27 19:36:28

我在 Java 1.6 上运行应用程序时遇到了这个问题,而我拥有针对不同应用程序的所有三个版本的 Java 6、7、8。我访问了导航器视图并从facet.core.xml 中手动删除了不需要的方面。干净的构建和瓦拉!

<?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"/>

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文