zrlw commented on issue #990: URL: https://github.com/apache/maven-compiler-plugin/issues/990#issuecomment-3496260625
https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html ``` 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. To avoid this issue, you can either configure the compiler's boot classpath to match the target JRE, or use the [Animal Sniffer Maven Plugin](http://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/) to verify your code doesn't use unintended APIs, or better yet use the [release option supported since JDK 9](https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html). Since plugin version 3.13.0 you can use the release property also on JDK 8. The compiler plugin will convert it to source and target automatically. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
