The problem is in the version of Java you are using for the compilation in Maven.
You can fix this in two ways:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source> <!-- Identificar a versão desejada aqui -->
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Or:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
These instructions above are equivalent.
I also suggest using the latest available version of the plugin, currently is the 3.8.1
.
Starting from Java 9, you must use release
instead of source
and target
, as below:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
If you are using Spring Boot, you can only identify the version of Java through the property java.version
:
<properties>
<java.version>11</java.version>
</properties>
Post the code in text format and if possible put the error also ,I suggest you read https://pt.meta.stackoverflow.com/questions/8089/guia-survivor%C3%aancia-do-sopt-vers%C3%a3o-short? cb=1 and edit your post so it won’t be closed.
– KALIBBAN