gpt4 book ai didi

Java编译器级别不匹配

转载 作者:行者123 更新时间:2023-12-01 15:18:36 25 4
gpt4 key购买 nike

我在 eclipse helios 中使用 jsf2 hibernate 4.1.4、spring 3.1 和 maven 3。但是当我尝试将依赖项添加到 POM 时出现此错误。

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

这是什么意思?我该如何解决这个错误?

我也有这个警告:

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.   

我的 POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.integrate</groupId>
<artifactId>integrate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>integrate</name>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<properties>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>

<dependencies>

<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>

<!-- JSF dependencies -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.6</version>
</dependency>

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.6</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>


<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>

<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>

<!-- oracle Connector dependency -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- c3p0 dependency -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>


</dependencies>

图片: enter image description here

最佳答案

只需将 build 部分和 ma​​ven-compiler-plugin 添加到您的 pom.xml 中即可。

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

然后您应该配置项目的构建路径。

或者您可以从 Eclipse 工作区中删除项目(而不从文件系统中删除),从项目中删除 Eclipse 的设置(.project、.classpath 和 .settings 文件和文件夹),然后将项目重新导入为现有 Maven项目到您的 IDE。 Eclipse 将正确重新生成其设置。

关于Java编译器级别不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11291727/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com