我在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>
照片:
答案 0 :(得分:1)
只需将构建部分与 maven-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将正确地重新生成其设置。
答案 1 :(得分:0)
请检查与项目有关的项目方面(右键单击项目/ Properties / Project Facets / Java )。
您系统中安装的java版本以及您在项目的项目构面中指定的版本可能不匹配。
答案 2 :(得分:0)
在D:\ maven-2.2.1 \ conf toolchains.xml
中指定Maven的java版本<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.5</version> <!--This should be same as is configured via the toolchains plugin -->
<vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.5.0</jdkHome>
</configuration>
</toolchain>
</toolchains>