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

zhangliang 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 a3139254c3c Refactor version system from template-based to pure Java 
implementation (#36924)
a3139254c3c is described below

commit a3139254c3cb88a873106f3431dfcbdc9345c274
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Oct 23 13:46:20 2025 +0800

    Refactor version system from template-based to pure Java implementation 
(#36924)
    
    * Refactor version system from template-based to pure Java implementation
    
    Replace templating-maven-plugin with maven-antrun-plugin for version 
properties generation.
    Implement three-tier version retrieval strategy: properties file → Manifest 
→ hardcoded fallback.
    Add comprehensive Git build information and 100% test coverage with JUnit.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
    
    * Move ShardingSphereVersion
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
---
 .../core/exporter/impl/BuildInfoExporter.java      |   2 +-
 .../core/exporter/impl/BuildInfoExporterTest.java  |   2 +-
 .../generator/core/JDBCExampleGenerator.java       |  19 ++-
 infra/common/pom.xml                               |  31 ++++-
 .../metadata/jdbc/JDBCInstanceMetaData.java        |   2 +-
 .../metadata/proxy/ProxyInstanceMetaData.java      |   2 +-
 .../ShardingSphereDefaultStatisticsBuilder.java    |   2 +-
 .../infra/version/ShardingSphereVersion.java       | 137 +++++++++++++++++++++
 .../autogen/version/ShardingSphereVersion.java     |  86 -------------
 .../infra/version/ShardingSphereVersionTest.java   |  72 +++++++++++
 .../opengauss/impl/OpenGaussSystemFunction.java    |   4 +-
 pom.xml                                            |   2 +-
 .../executor/FirebirdShowVariableExecutor.java     |   2 +-
 .../executor/FirebirdShowVariableExecutorTest.java |   2 +-
 .../executor/OpenGaussSelectVersionExecutor.java   |   4 +-
 .../OpenGaussShowVariableExecutorTest.java         |   2 +-
 .../executor/PostgreSQLShowVariableExecutor.java   |   2 +-
 .../PostgreSQLShowVariableExecutorTest.java        |   2 +-
 .../proxy/version/ShardingSphereProxyVersion.java  |   8 +-
 .../frontend/netty/CDCChannelInboundHandler.java   |   2 +-
 20 files changed, 263 insertions(+), 122 deletions(-)

diff --git 
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporter.java
 
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporter.java
index a55e6fc7393..fae5cee6780 100644
--- 
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporter.java
+++ 
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporter.java
@@ -22,7 +22,7 @@ import 
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeM
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.exporter.MetricsExporter;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 
 import java.util.Arrays;
 import java.util.Collections;
diff --git 
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
 
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
index b3faf415462..4c4b86498e6 100644
--- 
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
+++ 
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
@@ -22,7 +22,7 @@ import 
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeM
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
 import 
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 
diff --git 
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
 
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
index 038dd5e99f6..988a64cf989 100644
--- 
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
+++ 
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
@@ -25,7 +25,7 @@ import lombok.SneakyThrows;
 import 
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfiguration;
 import 
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfigurationValidator;
 import 
org.apache.shardingsphere.example.generator.scenario.ExampleScenarioFactory;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 
 import java.io.File;
@@ -45,16 +45,16 @@ public final class JDBCExampleGenerator {
     
     private static final String CONFIG_FILE = "/config.yaml";
     
-    private final Configuration templateConfig;
-    
-    String PROJECT_PATH = "shardingsphere-jdbc-sample/${feature?replace(',', 
'-')}--${framework}--${mode}--${transaction}/";
-    
-    String RESOURCES_PATH = "src/main/resources";
-    
     private static final String JAVA_CLASS_PATH = 
"src/main/java/org/apache/shardingsphere/example/"
             + "<#assign package = feature?replace('-', '')?replace(',', '.') 
/>"
             + "${package}/${framework?replace('-', '/')}";
     
+    private static final String PROJECT_PATH = 
"shardingsphere-jdbc-sample/${feature?replace(',', 
'-')}--${framework}--${mode}--${transaction}/";
+    
+    private static final String RESOURCES_PATH = "src/main/resources";
+    
+    private final Configuration templateConfig;
+    
     public JDBCExampleGenerator() throws IOException {
         templateConfig = createTemplateConfiguration();
     }
@@ -66,7 +66,6 @@ public final class JDBCExampleGenerator {
         return result;
     }
     
-    
     /**
      * Generate example.
      * 
@@ -133,7 +132,7 @@ public final class JDBCExampleGenerator {
      * @param exampleConfig example configuration
      * @return built output path
      */
-    private String buildOutputPath(YamlExampleConfiguration exampleConfig) {
+    private String buildOutputPath(final YamlExampleConfiguration 
exampleConfig) {
         if (Strings.isNullOrEmpty(exampleConfig.getOutput())) {
             File file = new 
File(Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath());
             return file.getParent() + "/generated-sources/" + PROJECT_PATH;
@@ -163,7 +162,7 @@ public final class JDBCExampleGenerator {
      * @return built data model
      */
     private Map<String, String> buildDataModel(final Properties props, final 
String mode, final String transaction, final String framework, final String 
feature) {
-        Map<String, String> result = new LinkedHashMap<>();
+        Map<String, String> result = new LinkedHashMap<>(props.size() + 5, 1F);
         props.forEach((key, value) -> result.put(key.toString(), 
value.toString()));
         result.put("mode", mode);
         result.put("transaction", transaction);
diff --git a/infra/common/pom.xml b/infra/common/pom.xml
index 6066b1265c5..a9a33a8aef5 100644
--- a/infra/common/pom.xml
+++ b/infra/common/pom.xml
@@ -95,17 +95,36 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>templating-maven-plugin</artifactId>
-                <version>${templating-maven-plugin.version}</version>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestEntries>
+                            
<Implementation-Version>${project.version}</Implementation-Version>
+                            
<Implementation-Title>${project.name}</Implementation-Title>
+                            
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>${maven-antrun-plugin.version}</version>
                 <executions>
                     <execution>
-                        <id>filtering-proxy-version</id>
+                        <id>generate-version-properties</id>
                         <goals>
-                            <goal>filter-sources</goal>
+                            <goal>run</goal>
                         </goals>
+                        <phase>generate-resources</phase>
                         <configuration>
-                            
<sourceDirectory>src/main/templates</sourceDirectory>
+                            <target>
+                                <mkdir dir="${project.build.outputDirectory}" 
/>
+                                <propertyfile comment="ShardingSphere Version 
Information" 
file="${project.build.outputDirectory}/shardingsphere-version.properties">
+                                    <entry key="version" 
value="${project.version}" />
+                                </propertyfile>
+                            </target>
                         </configuration>
                     </execution>
                 </executions>
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/jdbc/JDBCInstanceMetaData.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/jdbc/JDBCInstanceMetaData.java
index 10a60d961ef..975f695204a 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/jdbc/JDBCInstanceMetaData.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/jdbc/JDBCInstanceMetaData.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.infra.instance.metadata.jdbc;
 
 import lombok.Getter;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
 import org.apache.shardingsphere.infra.instance.util.IpUtils;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/proxy/ProxyInstanceMetaData.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/proxy/ProxyInstanceMetaData.java
index 607d0824e53..894ea4d8fee 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/proxy/ProxyInstanceMetaData.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/metadata/proxy/ProxyInstanceMetaData.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.infra.instance.metadata.proxy;
 
 import com.google.common.base.Joiner;
 import lombok.Getter;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
 import org.apache.shardingsphere.infra.instance.util.IpUtils;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/builder/ShardingSphereDefaultStatisticsBuilder.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/builder/ShardingSphereDefaultStatisticsBuilder.java
index b8224a11679..39ce5ac02ee 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/builder/ShardingSphereDefaultStatisticsBuilder.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/builder/ShardingSphereDefaultStatisticsBuilder.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.infra.metadata.statistics.builder;
 
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.statistics.DatabaseStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
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
new file mode 100644
index 00000000000..57759dcd0a5
--- /dev/null
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/version/ShardingSphereVersion.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.version;
+
+import com.google.common.base.Strings;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+/**
+ * ShardingSphere version.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ShardingSphereVersion {
+    
+    public static final String VERSION;
+    
+    public static final boolean IS_SNAPSHOT;
+    
+    public static final String BUILD_BRANCH;
+    
+    public static final String BUILD_TIME;
+    
+    public static final String BUILD_COMMIT_ID;
+    
+    public static final String BUILD_COMMIT_ID_ABBREV;
+    
+    public static final String BUILD_COMMIT_MESSAGE_SHORT;
+    
+    public static final String BUILD_TAG;
+    
+    public static final boolean BUILD_DIRTY;
+    
+    static {
+        VERSION = loadVersion();
+        IS_SNAPSHOT = VERSION.endsWith("SNAPSHOT");
+        Properties gitProps = loadGitProperties();
+        BUILD_BRANCH = gitProps.getProperty("git.branch", "");
+        BUILD_TIME = gitProps.getProperty("git.build.time", "");
+        BUILD_COMMIT_ID = gitProps.getProperty("git.commit.id", "");
+        BUILD_COMMIT_ID_ABBREV = gitProps.getProperty("git.commit.id.abbrev", 
"");
+        BUILD_COMMIT_MESSAGE_SHORT = 
gitProps.getProperty("git.commit.message.short", "");
+        BUILD_TAG = gitProps.getProperty("git.tags", "");
+        BUILD_DIRTY = Boolean.parseBoolean(gitProps.getProperty("git.dirty", 
"false"));
+    }
+    
+    private static String loadVersion() {
+        Optional<String> versionFromGeneratedPropsFile = 
loadVersionFromGeneratedPropertiesFile();
+        if (versionFromGeneratedPropsFile.isPresent()) {
+            return versionFromGeneratedPropsFile.get();
+        }
+        Optional<String> versionFromManifest = loadVersionFromManifest();
+        if (versionFromManifest.isPresent()) {
+            return versionFromManifest.get();
+        }
+        return "";
+    }
+    
+    private static Optional<String> loadVersionFromGeneratedPropertiesFile() {
+        try (InputStream inputStream = 
ShardingSphereVersion.class.getResourceAsStream("/shardingsphere-version.properties"))
 {
+            if (null == inputStream) {
+                return Optional.empty();
+            }
+            Properties props = new Properties();
+            props.load(inputStream);
+            String version = props.getProperty("version");
+            if (!Strings.isNullOrEmpty(version)) {
+                return Optional.of(version);
+            }
+        } catch (final IOException ignored) {
+        }
+        return Optional.empty();
+    }
+    
+    private static Optional<String> loadVersionFromManifest() {
+        try {
+            ClassLoader classLoader = 
ShardingSphereVersion.class.getClassLoader();
+            Enumeration<URL> resources = 
classLoader.getResources("META-INF/MANIFEST.MF");
+            while (resources.hasMoreElements()) {
+                URL resource = resources.nextElement();
+                try (InputStream inputStream = resource.openStream()) {
+                    Manifest manifest = new Manifest(inputStream);
+                    Attributes attributes = manifest.getMainAttributes();
+                    String title = attributes.getValue("Implementation-Title");
+                    String vendor = 
attributes.getValue("Implementation-Vendor");
+                    if (isShardingSphereManifest(title, vendor)) {
+                        String version = 
attributes.getValue("Implementation-Version");
+                        if (!Strings.isNullOrEmpty(version)) {
+                            return Optional.of(version);
+                        }
+                    }
+                }
+            }
+        } catch (final IOException ignored) {
+        }
+        return Optional.empty();
+    }
+    
+    private static boolean isShardingSphereManifest(final String title, final 
String vendor) {
+        return null != title && title.toLowerCase().contains("shardingsphere") 
|| null != vendor && vendor.toLowerCase().contains("apache");
+    }
+    
+    private static Properties loadGitProperties() {
+        try (InputStream inputStream = 
ShardingSphereVersion.class.getResourceAsStream("/current-git-commit.properties"))
 {
+            if (null != inputStream) {
+                Properties props = new Properties();
+                props.load(inputStream);
+                return props;
+            }
+        } catch (final IOException ignored) {
+        }
+        return new Properties();
+    }
+}
diff --git 
a/infra/common/src/main/templates/org/apache/shardingsphere/infra/autogen/version/ShardingSphereVersion.java
 
b/infra/common/src/main/templates/org/apache/shardingsphere/infra/autogen/version/ShardingSphereVersion.java
deleted file mode 100644
index 4d9e5c8958e..00000000000
--- 
a/infra/common/src/main/templates/org/apache/shardingsphere/infra/autogen/version/ShardingSphereVersion.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.autogen.version;
-
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Build info of ShardingSphere. 
- * Values prefixed with `BUILD` will be empty if building from source codes 
without .git directory.
- */
-public final class ShardingSphereVersion {
-    
-    public static final String VERSION = "${project.version}";
-    
-    static {
-        Properties info = new Properties();
-        try {
-            
info.load(ShardingSphereVersion.class.getResourceAsStream("/current-git-commit.properties"));
-        } catch (final Exception ignored) {
-        }
-        IS_SNAPSHOT = VERSION.endsWith("SNAPSHOT");
-        BUILD_BRANCH = info.getProperty("git.branch", "");
-        BUILD_TIME = info.getProperty("git.build.time", "");
-        BUILD_GIT_COMMIT_ID = info.getProperty("git.commit.id", "");
-        BUILD_GIT_COMMIT_ID_ABBREV = info.getProperty("git.commit.id.abbrev", 
"");
-        BUILD_GIT_COMMIT_MESSAGE_SHORT = 
info.getProperty("git.commit.message.short", "");
-        BUILD_GIT_TAG = info.getProperty("git.tags", "");
-        BUILD_GIT_DIRTY = Boolean.parseBoolean(info.getProperty("git.dirty"));
-    }
-    
-    public static final boolean IS_SNAPSHOT;
-    
-    public static final String BUILD_BRANCH;
-    
-    public static final String BUILD_TIME;
-    
-    public static final String BUILD_GIT_COMMIT_ID;
-    
-    public static final String BUILD_GIT_COMMIT_ID_ABBREV;
-    
-    public static final String BUILD_GIT_COMMIT_MESSAGE_SHORT;
-    
-    public static final String BUILD_GIT_TAG;
-    
-    public static final boolean BUILD_GIT_DIRTY;
-    
-    private ShardingSphereVersion() {
-    }
-    
-    /**
-     * Print version info of ShardingSphere to stdout.
-     *
-     * @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_GIT_COMMIT_ID.isEmpty()) {
-            result += String.format("Commit ID: %s%s%n", BUILD_GIT_DIRTY ? 
"dirty-" : "", BUILD_GIT_COMMIT_ID);
-            result += String.format("Commit Message: %s%n", 
BUILD_GIT_COMMIT_MESSAGE_SHORT);
-            result += BUILD_GIT_TAG.isEmpty() ? String.format("Branch: %s%n", 
BUILD_BRANCH) : String.format("Tag: %s%n", BUILD_GIT_TAG);
-            result += String.format("Build time: %s%n", BUILD_TIME);
-        }
-        return result;
-    }
-}
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/version/ShardingSphereVersionTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/version/ShardingSphereVersionTest.java
new file mode 100644
index 00000000000..e68964e227f
--- /dev/null
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/version/ShardingSphereVersionTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.version;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Test case for ShardingSphereVersion.
+ */
+class ShardingSphereVersionTest {
+    
+    @Test
+    void assertVersion() {
+        
assertTrue(ShardingSphereVersion.VERSION.matches("\\d+\\.\\d+\\.\\d+(-SNAPSHOT)?"));
+        
assertTrue(Integer.parseInt(ShardingSphereVersion.VERSION.split("-")[0].split("\\.")[0])
 >= 5);
+    }
+    
+    @Test
+    void assertIsSnapshot() {
+        assertThat(ShardingSphereVersion.IS_SNAPSHOT, 
is(ShardingSphereVersion.VERSION.endsWith("-SNAPSHOT")));
+    }
+    
+    @Test
+    void assertBuildBranch() {
+        assertNotNull(ShardingSphereVersion.BUILD_BRANCH);
+    }
+    
+    @Test
+    void assertBuildTime() {
+        assertNotNull(ShardingSphereVersion.BUILD_TIME);
+    }
+    
+    @Test
+    void assertCommitId() {
+        assertNotNull(ShardingSphereVersion.BUILD_COMMIT_ID);
+    }
+    
+    @Test
+    void assertCommitIdAbbrev() {
+        assertNotNull(ShardingSphereVersion.BUILD_COMMIT_ID_ABBREV);
+    }
+    
+    @Test
+    void assertCommitMessageShort() {
+        assertNotNull(ShardingSphereVersion.BUILD_COMMIT_MESSAGE_SHORT);
+    }
+    
+    @Test
+    void assertTag() {
+        assertNotNull(ShardingSphereVersion.BUILD_TAG);
+    }
+}
diff --git 
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/impl/OpenGaussSystemFunction.java
 
b/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/impl/OpenGaussSystemFunction.java
index b874eaaff80..fa852b40589 100644
--- 
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/impl/OpenGaussSystemFunction.java
+++ 
b/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/impl/OpenGaussSystemFunction.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss.
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 
 /**
  * PostgreSQL system function.
@@ -38,7 +38,7 @@ public final class OpenGaussSystemFunction {
      */
     @SuppressWarnings("unused")
     public static String version() {
-        return "ShardingSphere-Proxy " + ShardingSphereVersion.VERSION + ("-" 
+ ShardingSphereVersion.BUILD_GIT_COMMIT_ID_ABBREV) + 
(ShardingSphereVersion.BUILD_GIT_DIRTY ? "-dirty" : "");
+        return "ShardingSphere-Proxy " + ShardingSphereVersion.VERSION + ("-" 
+ ShardingSphereVersion.BUILD_COMMIT_ID_ABBREV) + 
(ShardingSphereVersion.BUILD_DIRTY ? "-dirty" : "");
     }
     
     /**
diff --git a/pom.xml b/pom.xml
index fd579ccea9f..587db421682 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,7 +148,7 @@
         <native-maven-plugin.version>0.11.0</native-maven-plugin.version>
         
         <!-- Compile plugin versions -->
-        
<templating-maven-plugin.version>1.0.0</templating-maven-plugin.version>
+        <maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
         <git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version>
         <maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
         <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
diff --git 
a/proxy/backend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutor.java
 
b/proxy/backend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutor.java
index d00d17681d2..fb82c936e17 100644
--- 
a/proxy/backend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutor.java
+++ 
b/proxy/backend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutor.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.backend.firebird.handler.admin.executor;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultColumnMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultMetaData;
diff --git 
a/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutorTest.java
 
b/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutorTest.java
index 056eed33bd1..2dde7958e9f 100644
--- 
a/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutorTest.java
+++ 
b/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/FirebirdShowVariableExecutorTest.java
@@ -18,7 +18,7 @@
 package 
org.apache.shardingsphere.proxy.backend.firebird.handler.admin.executor;
 
 import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
diff --git 
a/proxy/backend/dialect/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussSelectVersionExecutor.java
 
b/proxy/backend/dialect/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussSelectVersionExecutor.java
index 601e8b98b91..a88247fdfb7 100644
--- 
a/proxy/backend/dialect/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussSelectVersionExecutor.java
+++ 
b/proxy/backend/dialect/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussSelectVersionExecutor.java
@@ -18,7 +18,7 @@
 package 
org.apache.shardingsphere.proxy.backend.opengauss.handler.admin.executor;
 
 import lombok.Getter;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultColumnMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultMetaData;
@@ -45,7 +45,7 @@ public final class OpenGaussSelectVersionExecutor implements 
DatabaseAdminQueryE
     
     @Override
     public void execute(final ConnectionSession connectionSession, final 
ShardingSphereMetaData metaData) {
-        String version = "ShardingSphere-Proxy " + 
ShardingSphereVersion.VERSION + ("-" + 
ShardingSphereVersion.BUILD_GIT_COMMIT_ID_ABBREV) + 
(ShardingSphereVersion.BUILD_GIT_DIRTY ? "-dirty" : "");
+        String version = "ShardingSphere-Proxy " + 
ShardingSphereVersion.VERSION + ("-" + 
ShardingSphereVersion.BUILD_COMMIT_ID_ABBREV) + 
(ShardingSphereVersion.BUILD_DIRTY ? "-dirty" : "");
         mergedResult = new LocalDataMergedResult(Collections.singleton(new 
LocalDataQueryResultRow(version)));
     }
     
diff --git 
a/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussShowVariableExecutorTest.java
 
b/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussShowVariableExecutorTest.java
index b28dbca49ac..202f01d5683 100644
--- 
a/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussShowVariableExecutorTest.java
+++ 
b/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/executor/OpenGaussShowVariableExecutorTest.java
@@ -18,7 +18,7 @@
 package 
org.apache.shardingsphere.proxy.backend.opengauss.handler.admin.executor;
 
 import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
diff --git 
a/proxy/backend/dialect/postgresql/src/main/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutor.java
 
b/proxy/backend/dialect/postgresql/src/main/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutor.java
index 33f7fef9c94..2c8f9ed9a5d 100644
--- 
a/proxy/backend/dialect/postgresql/src/main/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutor.java
+++ 
b/proxy/backend/dialect/postgresql/src/main/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutor.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executo
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultColumnMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultMetaData;
diff --git 
a/proxy/backend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutorTest.java
 
b/proxy/backend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutorTest.java
index 76a88bdb9e1..208c7ba8fce 100644
--- 
a/proxy/backend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutorTest.java
+++ 
b/proxy/backend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/executor/PostgreSQLShowVariableExecutorTest.java
@@ -18,7 +18,7 @@
 package 
org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executor;
 
 import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
diff --git 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java
 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java
index b716d55c91e..d270f40aeee 100644
--- 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java
+++ 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java
@@ -23,7 +23,7 @@ import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.database.protocol.constant.CommonConstants;
 import 
org.apache.shardingsphere.database.protocol.constant.DatabaseProtocolServerInfo;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.database.DatabaseServerInfo;
@@ -54,11 +54,11 @@ public final class ShardingSphereProxyVersion {
     
     private static String getProxyVersion() {
         String result = ShardingSphereVersion.VERSION;
-        if (!ShardingSphereVersion.IS_SNAPSHOT || 
Strings.isNullOrEmpty(ShardingSphereVersion.BUILD_GIT_COMMIT_ID_ABBREV)) {
+        if (!ShardingSphereVersion.IS_SNAPSHOT || 
Strings.isNullOrEmpty(ShardingSphereVersion.BUILD_COMMIT_ID_ABBREV)) {
             return result;
         }
-        result += ShardingSphereVersion.BUILD_GIT_DIRTY ? "-dirty" : "";
-        result += "-" + ShardingSphereVersion.BUILD_GIT_COMMIT_ID_ABBREV;
+        result += ShardingSphereVersion.BUILD_DIRTY ? "-dirty" : "";
+        result += "-" + ShardingSphereVersion.BUILD_COMMIT_ID_ABBREV;
         return result;
     }
     
diff --git 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/CDCChannelInboundHandler.java
 
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/CDCChannelInboundHandler.java
index e66c8329b4d..f6f933f8eee 100644
--- 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/CDCChannelInboundHandler.java
+++ 
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/CDCChannelInboundHandler.java
@@ -46,7 +46,7 @@ import 
org.apache.shardingsphere.data.pipeline.core.exception.param.PipelineInva
 import 
org.apache.shardingsphere.database.exception.core.SQLExceptionTransformEngine;
 import 
org.apache.shardingsphere.database.exception.core.exception.connection.AccessDeniedException;
 import 
org.apache.shardingsphere.database.exception.core.exception.syntax.database.UnknownDatabaseException;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
 import org.apache.shardingsphere.infra.exception.ShardingSpherePreconditions;
 import 
org.apache.shardingsphere.infra.exception.external.sql.sqlstate.XOpenSQLState;
 import 
org.apache.shardingsphere.infra.exception.external.sql.type.kernel.category.PipelineSQLException;


Reply via email to