Reputation: 3753
I'm trying to build a project on java 8, specifying java 6 as the target:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Project settings:
General IDE (Java compiler) settings:
And I wind up with the error:
javacTask: source release 1.8 requires target release 1.8
Is it possible at all to build a project on java 8 with java 6 as the target?
Upvotes: 4
Views: 1744
Reputation: 4048
You can develop in Java 8 and target JDK 6, but it requires a bit of tweaking.
If you use a plugin like Retrolambda, combined with backported libraries such as StreamSupport and ThreeTen, you can use newer features on older JDKs.
Just make sure to use Animal Sniffer to ensure you're not using newer Java API methods or classes.
Upvotes: 4