Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add enforcer rule for jdk version used in dependencies #251

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<spotless.version>2.43.0</spotless.version>
<apache.rat.version>0.16.1</apache.rat.version>
<google.java.format.version>1.8</google.java.format.version>
<maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
<delta.standalone.version>0.5.0</delta.standalone.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<target.dir.pattern>**/target/**</target.dir.pattern>
Expand Down Expand Up @@ -542,12 +543,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<id>enforce-logging</id>
<id>enforce-logging-and-java-version</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<rules>
<bannedDependencies>
Expand All @@ -556,10 +559,28 @@
<exclude>log4j:log4j</exclude>
</excludes>
</bannedDependencies>
<!-- Ensure no dependencies are using incompatible versions of java -->
<enforceBytecodeVersion>
<maxJdkVersion>${java.version}</maxJdkVersion>
<ignoredScopes>test</ignoredScopes>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how frequent such a usecase is but i'm tempted to put <strict>true</strict> as well here. By default it's set to false and could lead to issues? Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try it out. It is better to be as "strict" as possible for now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causing lots of breakages: jackson, lombok, log4j all trigger the enforcer rule now

</enforceBytecodeVersion>
<requireJavaVersion>
<version>[${source.java.version},)</version>
<message>
At least JDK ${source.java.version} is required to build this project.
</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -764,6 +785,7 @@
<goals>
<goal>check</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
Expand Down
Loading