im getting below message when run 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;
the project is simple maven project but wont compile with generics error when i have already set JAVA_HOME to jdk1.7 installation path
however when i add plug in then it works fine. why is it required to explicitly set hava home path.
<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>
You need to tell Maven to use JDK 1.5 to compile your source code explicitly. Declare Maven compiler plugin (maven-compiler-plugin) in your pom.xml file, like this:
<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>
</project>
generics are not supported in -source 1.3
The error message is perfectly clear. You've told the compiler to compile in -source 1.3 mode, where there are no generics. So, there are no generics.
its old question. and after waiting for quite some time back then i didnt get answer. however while browsing maven compiler plugin docs i came to know that plugin has default settings. so earlier versions used to use jdk 1.3 as default for source/target and now it uses 1.5 e,g. after reading docs n running "mvn clean install -X" observed that,
Hence there was error till "maven-compiler-plugin" and its configurations(source/target) were not specified in pom.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.