为什么我需要将项目合规性更改为1.5? [英] Why do I need to change project compliance to 1.5?

查看:121
本文介绍了为什么我需要将项目合规性更改为1.5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse上使用maven2创建了一个项目.添加hibernate-annotations依赖项后,我试图使用hibernate注释(@ Entity,@ Table ...)创建一个类,但这给了我这个错误:

I created a project with maven2 on eclipse. After I added the hibernate-annotations dependency, i was trying to create a class using hibernate annotations(@Entity, @Table...), but it was giving me this error :

将项目合规性和JRE更改为1.5

Change project compliance and JRE to 1.5

我已修复它,但无法理解为什么只要我的jdk为1.6,就需要这样做.

I fixed it, but cannot understand why it requires this as long as my jdk is 1.6.

提前谢谢!

推荐答案

检查maven编译器插件的设置是否也设置为1.5或1.6.如果我没记错的话,maven 2的默认值为1.4.

Check that the settings for the maven compiler plugin is set to 1.5 or 1.6 as well. If I'm not mistaken maven 2 defaults to 1.4.

类似这样的东西:

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>

这篇关于为什么我需要将项目合规性更改为1.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆