我在运行 mvn clean install 时收到以下消息
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
D:\data\work\extjs.parser\src\main\java\com\model\Component.java:[17,15] error:
generics are not supported in -source 1.3
could not parse error message: (use -source 5 or higher to enable generics)
D:\data\work\extjs.parser\src\main\java\com\model\Container.java:14: error: gene
rics are not supported in -source 1.3
private List<Component> items;
该项目是简单的 maven 项目,但是当我已经将 JAVA_HOME 设置为 jdk1.7 安装路径时,不会编译泛型错误
但是,当我添加插件时,它工作正常。为什么需要显式设置 hava 主路径。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${env.JAVA_HOME}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
提前致谢...