The problem is that I haven't done any setup since I installed Maven, I got Error:generics is not supported In-source 1.3 and Error:for-each loops when I use command mvn install n OT supported In-source 1.3, the first feeling is that there is a problem with the JDK (the cause of the error is obviously compiled with JDK1.3), but the project's JDK is set to 1.7, and the language is 7.0.
Here are two options (global settings and single-project settings) to solve the problem.
1. The global setting is to modify the MAVEN configuration file, you should first find your MAVEN installation directory, I use Linux, mvn-v can know path.
Under the Conf folder, locate the settings.xml under the Profiles node to add:
<profile> <id>jdk-1.7</id> <activation> <activebydefault>true</activebydefau lt> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source> 1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <MAVEN.C Ompiler.compilerversion>1.7</maven.compiler.compilerversion> </properties></profile>
OK, here is the 1.7 configuration, you can change to any version you need.
2. Project setup is to add plugin to your MAVEN project's Pom.xml file.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId> maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.7 </source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> </ Plugins> </build>
This project MAVEN will use 1.7 to compile.
Maven modifies the default JDK version and the specified project JDK version