views:

123

answers:

1

I am using eclipse, with maven2 plugin. I am trying to setup a simple annotations based spring 3 mvc web application.

So I went to RunAs and clicked on 'maven build', I set the goal as 'compile'.

When it compiles, I get the error message:

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

so far I modified the eclipse.ini to use the jdk. I also made sure under preferences, it is at java 1.6.

Not sure where else to change the java version?

(I am assuming source 1.3 means java 1.3 and that I need it to be at least version 1.5 compatible)

+5  A: 

You should also set a proper source version in pom.xml (because maven can make builds without Eclipse, so it can't use Eclipse preferences):

<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>
axtavt
do I use my groupID and articleId there?
Blankman
No, that's the groupID and artifactId of the plugin you like to configure. So you need to use exactly the values that are shown here.
Joachim Sauer
@Blankman: No, these groupId and artifactId identify the maven-compiler-plugin
axtavt
Ahh... the configuration hell of a modern development environment.
Software Monkey