开发者

Maven confused about JRE been used

I've created a project in eclipse and added maven dependencies. In Eclipse, it says that I am using JRE 1.5. Everything works fine in Eclipse, for instance, I can run my tests.

When I try to run mvn clean install from the terminal, it gives me the following error.

...generics are not supported in -source 1.3 (use -source 5 or higher to enable generics)...

Its seems that Maven thinks I'm using JRE 1.3 and cannot recognize generics or for-each loops.

How can I:

  • Validate my assumption that mav开发者_Go百科en is using the wrong version.
  • Get Maven to compile my project.


Specify the correct version of your JRE in the Maven compiler plugin, by default your pom.xml file will inherit the compiler-plugin from the Maven super pom.xml which targets the 1.3 JRE.

     <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>    
        </plugins>
    </build>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜