将-source设置为1.5,显然设置为1.3

Bla*_*man 1 java eclipse spring maven-2

我正在使用eclipse,使用maven2插件.我正在尝试设置一个简单的注释基于spring 3 mvc web应用程序.

所以我去了RunAs并点击'maven build',我将目标定为'compile'.

编译时,我收到错误消息:

E:\dev\eclipse\springmvc2\src\main\java\web\HomeController.java:[5,1] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Controller
Run Code Online (Sandbox Code Playgroud)

到目前为止,我修改了eclipse.ini以使用jdk.我也确定在首选项下,它是在java 1.6.

不确定在哪里改变java版本?

(我假设源1.3意味着java 1.3,我需要它至少兼容1.5版本)

axt*_*avt 6

您还应该设置一个合适的源版本pom.xml(因为maven可以在没有Eclipse的情况下进行构建,因此它不能使用Eclipse首选项):

<project ...>    
    ...    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...
</project>
Run Code Online (Sandbox Code Playgroud)