Specifying the Java version for the Compiler plugin
When we created a new project in Eclipse, you would have observed the following warning:
Why does this error occur? This is because the Maven Compiler plugin, by default, considers the source
and target
Java version to be 1.5
(for backward compatibility reasons).
Let us resolve this warning.
How to do it...
Let us assume you have configured Java 8 as the default Java runtime in Eclipse, and perform the following steps:
Open the Eclipse project.
Add the following configuration to the Maven Compiler plugin:
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins>
Alternately, add the following properties...