You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2023/01/08 13:09:22 UTC

[kyuubi] branch master updated: [KYUUBI #4109] Enforce max Java bytecode version in Maven dependencies with `enforceBytecodeVersion` rule

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 65b393c45 [KYUUBI #4109] Enforce max Java bytecode version in Maven dependencies with `enforceBytecodeVersion` rule
65b393c45 is described below

commit 65b393c4562396e373849e8fa65ad3605b0f0c73
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Sun Jan 8 21:09:13 2023 +0800

    [KYUUBI #4109] Enforce max Java bytecode version in Maven dependencies with `enforceBytecodeVersion` rule
    
    ### _Why are the changes needed?_
    
    - Enforce max Java bytecode version in dependencies with `enforceBytecodeVersion` rule from MojoHaus‘s Extra Enforcer Rules (https://www.mojohaus.org/extra-enforcer-rules/enforceBytecodeVersion.html)
    - Prevent accidentally bumping or introducing maven dependencies a Java version over baseline (currently Java 8)
    
    Currently, some dependencies remain on older versions for Java 8 compatibility. This enforceBytecodeVersion  rule will help to enforce them aligning to Java 8.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4109 from bowenliang123/enforcer-bytecode-version.
    
    Closes #4109
    
    8dfe6e4be [liangbowen] use shorter param name `maven.plugin.enforcer.mojo.rules.version`
    b85a89d0f [liangbowen] move plugin definition and dependency to pluginManagement block
    58377f800 [liangbowen] add enforceBytecodeVersion rule to maven-enforcer-plugin
    
    Authored-by: liangbowen <li...@gf.com.cn>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 pom.xml | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/pom.xml b/pom.xml
index a41160bc5..f8c21aa1d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -212,6 +212,7 @@
 
         <maven.plugin.build.helper.version>3.2.0</maven.plugin.build.helper.version>
         <maven.plugin.download.version>1.6.6</maven.plugin.download.version>
+        <maven.plugin.enforcer.mojo.rules.version>1.6.1</maven.plugin.enforcer.mojo.rules.version>
         <maven.plugin.scala.version>4.6.1</maven.plugin.scala.version>
         <maven.plugin.surefire.version>3.0.0-M7</maven.plugin.surefire.version>
         <maven.plugin.scalatest.version>2.0.2</maven.plugin.scalatest.version>
@@ -2090,6 +2091,18 @@
                         </execution>
                     </executions>
                 </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.codehaus.mojo</groupId>
+                            <artifactId>extra-enforcer-rules</artifactId>
+                            <version>${maven.plugin.enforcer.mojo.rules.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
             </plugins>
         </pluginManagement>
 
@@ -2146,6 +2159,29 @@
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>enforce-bytecode-version</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <banCircularDependencies/>
+                                <enforceBytecodeVersion>
+                                    <maxJdkVersion>${java.version}</maxJdkVersion>
+                                    <ignoredScopes>test</ignoredScopes>
+                                </enforceBytecodeVersion>
+                            </rules>
+                            <fail>true</fail>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>