incubator-xtable icon indicating copy to clipboard operation
incubator-xtable copied to clipboard

add enforcer rule for jdk version used in dependencies

Open the-other-tim-brown opened this issue 2 years ago • 1 comments

What is the purpose of the pull request

Prevents runtime issues where we depend on a dependency that requires a newer version of java to run.

Brief change log

  • Add enforcer rule
  • Update some execution phases so rules do not slow down compile time and style check runs in test instead of integration-test phase for quicker feedback

Verify this pull request

This pull request is a trivial rework / code cleanup without any test coverage.

the-other-tim-brown avatar Nov 18 '23 00:11 the-other-tim-brown

@the-other-tim-brown should we revive this PR? I used this idea on one of my projects, thanks for exploring these options.

BTW, we can add more specific enforcements to fail the build if lets say they try to build with jdk8. Here are few rules that I'm using at compile phase itself and found them useful:

<bannedDependencies>
    <excludes>
        <exclude>org.slf4j:slf4j-log4j12</exclude>
        <exclude>log4j:log4j</exclude>
    </excludes>
</bannedDependencies>
<dependencyConvergence/>
<requireJavaVersion>
    <version>[${source.java.version},)</version>
    <message>
        At least JDK ${source.java.version} is required to build this project.
    </message>
</requireJavaVersion>

ksumit avatar Jul 25 '24 07:07 ksumit