I'm getting all sort of java errors not supported in -source 1.5 when creating my Maven Install in eclipse. There is nothing wrong with my code.
Errors follows:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1
[23,62] multi-catch statement is not supported in -source 1.5
[241,29] try-with-resources is not supported in -source 1.5
[156,64] diamond operator is not supported in -source 1.5
My pom configuration follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Add the following lines in your pom.xml file should resolve your problem.
for java 11 use:
If you may take in consideration the advises that were provided to you. You would have 2 options to choose from:
Option 1) If you keep the maven-war-plugin. Update version to the latest then add the properties with the compiler info and sourceEncoding but remove the configuration lines:
Option 2) If you replace maven-war-plugin with the maven-compiler-plugin ** There are no need to add/replace the source, target and encoding to the properties**. Make sure to update the version to the latest: