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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7c23197d897 Fix print_version in proxy start scripts (#37815)
7c23197d897 is described below

commit 7c23197d8970c84574c9d7405682ffef2a8750fa
Author: Raigor <[email protected]>
AuthorDate: Thu Jan 22 23:08:30 2026 +0800

    Fix print_version in proxy start scripts (#37815)
---
 distribution/proxy/src/main/resources/bin/start.bat |  2 +-
 distribution/proxy/src/main/resources/bin/start.sh  |  2 +-
 .../infra/version/ShardingSphereVersion.java        | 21 +++++++++++++++++++++
 src/resources/checkstyle.xml                        |  2 +-
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/distribution/proxy/src/main/resources/bin/start.bat 
b/distribution/proxy/src/main/resources/bin/start.bat
index e1b8f8f97b0..990baecf2e0 100644
--- a/distribution/proxy/src/main/resources/bin/start.bat
+++ b/distribution/proxy/src/main/resources/bin/start.bat
@@ -100,7 +100,7 @@ goto exit
  goto exit
 
 :print_version
- java -classpath %CLASS_PATH% 
org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion
+ java -classpath %CLASS_PATH% 
org.apache.shardingsphere.infra.version.ShardingSphereVersion
  goto exit
 
 :exit
diff --git a/distribution/proxy/src/main/resources/bin/start.sh 
b/distribution/proxy/src/main/resources/bin/start.sh
index 3c81385d2c1..06ea1eff3ed 100644
--- a/distribution/proxy/src/main/resources/bin/start.sh
+++ b/distribution/proxy/src/main/resources/bin/start.sh
@@ -129,7 +129,7 @@ if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
 fi
 
 print_version() {
-    $JAVA ${JAVA_OPTS} ${JAVA_MEM_OPTS} -classpath ${CLASS_PATH} 
org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion
+    $JAVA ${JAVA_OPTS} ${JAVA_MEM_OPTS} -classpath ${CLASS_PATH} 
org.apache.shardingsphere.infra.version.ShardingSphereVersion
     exit 0
 }
 
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/version/ShardingSphereVersion.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/version/ShardingSphereVersion.java
index 6654203c874..6f6699a9344 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/version/ShardingSphereVersion.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/version/ShardingSphereVersion.java
@@ -67,6 +67,27 @@ public final class ShardingSphereVersion {
         BUILD_DIRTY = Boolean.parseBoolean(gitProps.getProperty("git.dirty", 
"false"));
     }
     
+    /**
+     * Main method.
+     *
+     * @param args args
+     */
+    public static void main(final String[] args) {
+        System.out.print(getVerboseVersion());
+    }
+    
+    private static String getVerboseVersion() {
+        String result = "";
+        result += String.format("ShardingSphere-%s%n", VERSION);
+        if (IS_SNAPSHOT && !BUILD_COMMIT_ID.isEmpty()) {
+            result += String.format("Commit ID: %s%s%n", BUILD_DIRTY ? 
"dirty-" : "", BUILD_COMMIT_ID);
+            result += String.format("Commit Message: %s%n", 
BUILD_COMMIT_MESSAGE_SHORT);
+            result += BUILD_TAG.isEmpty() ? String.format("Branch: %s%n", 
BUILD_BRANCH) : String.format("Tag: %s%n", BUILD_TAG);
+            result += String.format("Build time: %s%n", BUILD_TIME);
+        }
+        return result;
+    }
+    
     private static String loadVersion() {
         Optional<String> versionFromGeneratedPropsFile = 
loadVersionFromGeneratedPropertiesFile();
         if (versionFromGeneratedPropsFile.isPresent()) {
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index d5340e34c58..8ef7d0dbd6a 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -223,7 +223,7 @@
         <module name="TodoComment" />
         <module name="TrailingComment" />
         <module name="UncommentedMain">
-            <property name="excludedClasses" value="\.Bootstrap" />
+            <property name="excludedClasses" 
value="\.Bootstrap$|ShardingSphereVersion$" />
         </module>
         <module name="UpperEll" />
         

Reply via email to