This is an automated email from the ASF dual-hosted git repository.
Apache9 pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.6 by this push:
new 3d0df45c531 HBASE-30272 Compatiblity checker can not compile rel/2.0.0
when releasing 3.0.0-beta-2 (#8451)
3d0df45c531 is described below
commit 3d0df45c5311041de87ade8b31e217bfc4d79f2c
Author: Duo Zhang <[email protected]>
AuthorDate: Fri Jul 3 17:13:07 2026 +0800
HBASE-30272 Compatiblity checker can not compile rel/2.0.0 when releasing
3.0.0-beta-2 (#8451)
Signed-off-by: Xiao Liu <[email protected]>
(cherry picked from commit 448bd2486f26db2b3732386c04ef3057efb4cf5a)
---
dev-support/checkcompatibility.py | 46 +++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
diff --git a/dev-support/checkcompatibility.py
b/dev-support/checkcompatibility.py
index 914f8dd42f1..6460411799b 100755
--- a/dev-support/checkcompatibility.py
+++ b/dev-support/checkcompatibility.py
@@ -44,6 +44,7 @@ import sys
import urllib.request
import urllib.error
import urllib.parse
+import xml.etree.ElementTree as xml
from collections import namedtuple
try:
import argparse
@@ -135,7 +136,33 @@ def get_repo_name(remote_name="origin"):
return remote[:-4] if remote.endswith(".git") else remote
-def build_tree(java_path, verbose):
+def select_java_home(java_path, java8_home, java17_home):
+ pom = xml.parse(os.path.join(java_path, "pom.xml"))
+ root = pom.getroot()
+ ns = ""
+ if root.tag.startswith("{"):
+ ns = root.tag.split("}")[0] + "}" # e.g.
"{http://maven.apache.org/POM/4.0.0}"
+ version_elem = root.find(f"{ns}version")
+ if version_elem is not None and version_elem.text:
+ version = version_elem.text.strip()
+ else:
+ raise ValueError("Could not find project version")
+ if version == "${revision}":
+ properties_elem = root.find(f"{ns}properties")
+ if properties_elem is None:
+ raise ValueError("Could not find properties")
+ revision_elem = properties_elem.find(f"{ns}revision")
+ if revision_elem is not None and revision_elem.text:
+ version = revision_elem.text.strip()
+ else:
+ raise ValueError("Could not find project revision")
+ if version.startswith("3."):
+ return java17_home
+ else:
+ return java8_home
+
+
+def build_tree(java_path, verbose, java8_home, java17_home):
""" Run the Java build within 'path'. """
logging.info("Building in %s ", java_path)
# special hack for comparing with rel/2.0.0, see HBASE-26063 for more
details
@@ -144,7 +171,10 @@ def build_tree(java_path, verbose):
"-Dmaven.javadoc.skip=true", "package"]
if not verbose:
mvn_cmd.insert(-1, "--quiet")
- subprocess.check_call(mvn_cmd, cwd=java_path)
+ env = os.environ.copy()
+ if java8_home and java17_home:
+ env["JAVA_HOME"] = select_java_home(java_path, java8_home, java17_home)
+ subprocess.check_call(mvn_cmd, cwd=java_path, env=env)
def checkout_java_acc(force):
@@ -444,6 +474,14 @@ def main():
parser.add_argument("--skip-build",
action="store_true",
help="Skip building the projects.")
+ parser.add_argument("--java8_home",
+ default=None,
+ help="Path to Java 8 installation. "
+ "Used for building projects with version < 3.0.")
+ parser.add_argument("--java17_home",
+ default=None,
+ help="Path to Java 17 installation. "
+ "Used for building projects with version >= 3.0.")
parser.add_argument("--verbose",
action="store_true",
help="more output")
@@ -516,8 +554,8 @@ def main():
if args.skip_build:
logging.info("Skipping the build")
else:
- build_tree(src_dir, args.verbose)
- build_tree(dst_dir, args.verbose)
+ build_tree(src_dir, args.verbose, args.java8_home, args.java17_home)
+ build_tree(dst_dir, args.verbose, args.java8_home, args.java17_home)
# Find the JARs.
src_jars = find_jars(src_dir)