我正在尝试编译一个maven项目,源代码使用Generics和Java 1.5的其他特性,从而导致我的构建失败
在我的POM.xml
我已经配置针对1.5的源和目标属性的生成配置,但是这并没有解决我的问题
我是对的POM.xml
,还是我错过了什么?
谢谢
<?xml version="1.0" encoding="UTF-8"?>
<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>
<name>MyClass</name>
<groupId>uk.co.mydomain</groupId>
<artifactId>MyClass</artifactId>
<version>1.0</version>
<build>
<finalName>MyClass</finalName>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<descriptors>
<descriptor>src/main/resources/dist.xml</descriptor>
</descriptors>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>sun-repo-2</id>
<url>http://download.java.net/maven/2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
Run Code Online (Sandbox Code Playgroud)
在确定构建时的输出
generics are not supported in -1.3 (use -source 5 or higher to enable generics)
Run Code Online (Sandbox Code Playgroud) 我正在使用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版本)