[英]Why does mvn 3.0.4 use -source 1.3 on Ubuntu 13.04 when I have Oracle JDK 1.7 installed?
I have mvn 3.0.4 and Oracle JDK 1.7 installed on Ubuntu 13.04. 我在Ubuntu 13.04上安装了mvn 3.0.4和Oracle JDK 1.7。 When I build an existing project I get
当我建立一个现有项目时,我得到
error: generics are not supported in -source 1.3
This same project works on Windows 7 with JDK 1.7 and mvn 3.0.4 without modifying the pom.xml to tell it which version of Java to use. 该项目在Windows 7以及JDK 1.7和mvn 3.0.4上运行,而无需修改pom.xml来告诉它要使用的Java版本。
Ubuntu has openjdk 1.7 installed, but I have Oracle JDK 1.7 in the path before openjdk. Ubuntu已安装了openjdk 1.7,但在openjdk之前的路径中有Oracle JDK 1.7。
What's wrong with maven on Ubuntu 13.04? Ubuntu 13.04上的maven有什么问题?
Thanks. 谢谢。
You need to tell Maven to use JDK 1.5(???) to compile your source code explicitly. 您需要告诉Maven使用JDK 1.5(???)显式编译源代码。 Declare Maven compiler plugin (maven-compiler-plugin) in your pom.xml file, like this :
在pom.xml文件中声明Maven编译器插件(maven-compiler-plugin),如下所示:
File : pom.xml 档案:pom.xml
<project ...>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
I removed mvn 3.0.4 (Ubuntu packaged version) and installed 3.1.0 (from Apache web site) and it now works. 我删除了mvn 3.0.4(Ubuntu打包版本)并安装了3.1.0(来自Apache网站),现在可以使用了。 There must be a problem with the packaged version of mvn 3.0.4 for Ubuntu.
适用于Ubuntu的mvn 3.0.4的打包版本一定存在问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.