eclipse / microprofile-parent

Apache License 2.0
2 stars 19 forks source link

Configure javac to use --release when building on JDK 9+ #58

Closed bjhargrave closed 2 years ago

bjhargrave commented 2 years ago

We use the maven-compiler-plugin's maven.compiler.release property to configure the --release value when building on JDK 9 or later. Using --release is preferable to using --source/--target as --release also factors in the class libraries available in the release.

Unfortunately, setting this property when building on JDK 8 causes a build error as the maven-compiler-plugin passes the --release option to javac which does not understand it. So we use a maven profile to set the property only when JDK is 9 or higher.

ederks85 commented 2 years ago

Nice solution! LGTM

JanWesterkamp-iJUG commented 2 years ago

@bjhargrave This is a nice workaround for this issue!

bjhargrave commented 2 years ago

This is a nice workaround for this issue!

Thanks. I have been using this for a while in all my projects using maven.