Skip to content

Commit

Permalink
Allow specifying Java release version for forbiddenapis
Browse files Browse the repository at this point in the history
When forbidden-apis is too old to support a certain Java version (e.g.,
21), we can override the release compliance level via a Maven property
and forcibly specify a lower Java version via
"forbiddenapis.releaseVersion".

This may not always work, but is better than nothing.

policeman-tools/forbidden-apis#233
  • Loading branch information
kohlschuetter committed Sep 15, 2023
1 parent 1ca6db1 commit c83e1dd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<kohlschutter.java.release>1.8</kohlschutter.java.release>
<maven.compiler.source>${kohlschutter.java.release}</maven.compiler.source>
<maven.compiler.target>${kohlschutter.java.release}</maven.compiler.target>
<forbiddenapis.releaseVersion>${kohlschutter.java.release}</forbiddenapis.releaseVersion>
<!-- Projects must define the following property -->
<kohlschutter.project.base.directory>${project.basedir}</kohlschutter.project.base.directory>
<kohlschutter.parent.directory>${project.basedir}</kohlschutter.parent.directory>
Expand Down Expand Up @@ -708,6 +709,7 @@
<!-- if the used Java version is too new, don't fail, just
do nothing -->
<failOnUnsupportedJava>false</failOnUnsupportedJava>
<releaseVersion>${forbiddenapis.releaseVersion}</releaseVersion>
<excludes>
<exclude>**/module-info.class</exclude>
</excludes>
Expand Down

0 comments on commit c83e1dd

Please sign in to comment.