This is an automated email from the ASF dual-hosted git repository.
vernedeng pushed a commit to branch release-2.2.0
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/release-2.2.0 by this push:
new cdbfc6466b [INLONG-11861][CI] Compile dataproxy-sdk fail when there is
no .git dictionary in the base path (#11862)
cdbfc6466b is described below
commit cdbfc6466b4184d81cfd4e1f96be6e0e0b54dcfe
Author: Goson Zhang <[email protected]>
AuthorDate: Tue May 13 10:44:35 2025 +0800
[INLONG-11861][CI] Compile dataproxy-sdk fail when there is no .git
dictionary in the base path (#11862)
(cherry picked from commit 12c2998dd68105fcbefcc9e714507a749c9de6af)
---
.licenserc.yaml | 3 ++
inlong-sdk/dataproxy-sdk/pom.xml | 35 ++++++++--------------
.../inlong/sdk/dataproxy/utils/ProxyUtils.java | 16 +++++++---
.../dataproxy-sdk/src/main/resources/sdk.version | 1 +
pom.xml | 2 ++
5 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/.licenserc.yaml b/.licenserc.yaml
index 629ff90fa4..048f4ff30b 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -93,4 +93,7 @@ header:
- '**/tubemq-client-go/go.sum'
- '**/dataproxy-sdk-golang/go.sum'
+ # dataproxy sdk version
+ - '**/resources/sdk.version'
+
comment: on-failure
diff --git a/inlong-sdk/dataproxy-sdk/pom.xml b/inlong-sdk/dataproxy-sdk/pom.xml
index fb4799af7a..6333eeb921 100644
--- a/inlong-sdk/dataproxy-sdk/pom.xml
+++ b/inlong-sdk/dataproxy-sdk/pom.xml
@@ -117,7 +117,20 @@
</dependencies>
<build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -174,28 +187,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>io.github.git-commit-id</groupId>
- <artifactId>git-commit-id-maven-plugin</artifactId>
- <version>4.9.9</version>
- <configuration>
- <generateGitPropertiesFile>true</generateGitPropertiesFile>
-
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
- <includeOnlyProperties>
-
<includeOnlyProperty>^git.build.(version)$</includeOnlyProperty>
- </includeOnlyProperties>
- <commitIdGenerationMode>full</commitIdGenerationMode>
- </configuration>
- <executions>
- <execution>
- <id>get-the-git-infos</id>
- <goals>
- <goal>revision</goal>
- </goals>
- <phase>initialize</phase>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
diff --git
a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/utils/ProxyUtils.java
b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/utils/ProxyUtils.java
index 7aafca8237..e6eeab12b0 100644
---
a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/utils/ProxyUtils.java
+++
b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/utils/ProxyUtils.java
@@ -104,11 +104,19 @@ public class ProxyUtils {
if (sdkVersion != null) {
return sdkVersion;
}
- Properties properties = new Properties();
- try (InputStream is =
ProxyUtils.class.getResourceAsStream("/git.properties")) {
- properties.load(is);
- sdkVersion = properties.getProperty("git.build.version");
+ try (InputStream is =
ProxyUtils.class.getClassLoader().getResourceAsStream("sdk.version")) {
+ if (is == null) {
+ sdkVersion = "unknown";
+ if (exceptCounter.shouldPrint()) {
+ logger.error("Missing sdk.version file!");
+ }
+ } else {
+ Properties properties = new Properties();
+ properties.load(is);
+ sdkVersion = properties.getProperty("version");
+ }
} catch (Throwable ex) {
+ sdkVersion = "unknown";
if (exceptCounter.shouldPrint()) {
logger.error("DataProxy-SDK get version failure", ex);
}
diff --git a/inlong-sdk/dataproxy-sdk/src/main/resources/sdk.version
b/inlong-sdk/dataproxy-sdk/src/main/resources/sdk.version
new file mode 100644
index 0000000000..e5683df88c
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk/src/main/resources/sdk.version
@@ -0,0 +1 @@
+version=${project.version}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6ed02c5503..cf15a3c4d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1490,6 +1490,8 @@
<exclude>**/dataproxy-sdk-golang/go.sum</exclude>
<!-- Docker build-->
<exclude>**/docker/docker-compose/**/**</exclude>
+ <!-- dataproxy sdk version -->
+ <exclude>**/resources/sdk.version</exclude>
</excludes>
</configuration>