Java : Spring : Source option 6 is no longer supported. Use 7 or later

Java : Spring : Source option 6 is no longer supported. Use 7 or later

Today i just tried to build my first web Java application. I follow the instructions from this link: https://docs.spring.io/spring-boot/docs/1.0.2.RELEASE/reference/html/getting-started-first-application.html

Everything looks good until i reach to step 10.4 ,  i got this error

[ERROR] Source option 6 is no longer supported. Use 7 or later.
[ERROR] Target option 6 is no longer supported. Use 7 or later.

Some recommend that we need to add this in to <project> tag

<properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
</properties>

It works for some people , but it’s not working for me. Finally i found that i need to add this

<properties>
    <java.version>1.9</java.version>
</properties>

More detail is from this url: https://www.baeldung.com/maven-java-version

This is my final pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <groupId>com.example</groupId>
    <artifactId>myproject</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.0.2.RELEASE</version>
    </parent>

    <!-- Aditional lines to be added here... -->


<properties>
    <java.version>1.9</java.version>
</properties>

    <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>



</project>

Leave a Reply

Your email address will not be published. Required fields are marked *