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
1 2 |
[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
1 2 3 4 |
<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
1 2 3 |
<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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<?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