When encountering compiler errors, such as "generics are not supported in -source 1.3," it's necessary to modify the pom.xml file to specify the correct Java compiler version.
In the provided pom.xml file, the maven-compiler-plugin dependency is already included. To change the compiler version, you can use the following properties:
<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
This sets both the source and target compiler versions to 1.8, ensuring your code compiles correctly.
For Maven 3.2.5 or above, these properties can be used to modify the compiler version in the pom.xml file.
The above is the detailed content of How to Specify the Java Compiler Version in a pom.xml File?. For more information, please follow other related articles on the PHP Chinese website!