I have searched all the answers on why we should have source different than target but non is convencing:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.7</source>
<target>1.8</target>
</configuration>
</plugin>
If JDK is backward compatible why do I need to set the target to 1.8 when the compilation is done on 1.7 ?
Setting the source higher than target won't work , example for the error :
Source release 8 requires target release 1.8
Also from Maven :
Merely setting the target option does not guarantee that your code actually runs on a JRE with the specified version. The pitfall is unintended usage of APIs that only exist in later JREs which would make your code fail at runtime with a linkage error
Can anyone give example ? maven source and target are for my own source code not for the dependencies , then what is the case I can use API in later JRE ( in my own code ) compiles successfully ?