Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,7 @@ header:
- '**/tubemq-client-go/go.sum'
- '**/dataproxy-sdk-golang/go.sum'

# dataproxy sdk version
- '**/resources/sdk.version'

comment: on-failure
35 changes: 13 additions & 22 deletions inlong-sdk/dataproxy-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ public static String getJarVersion() {
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")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/main/resources false src/main/resources-filtered true

https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Using Maven resource filtering seems to be a good solution, which does not rely on git.

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);
}
Expand Down
1 change: 1 addition & 0 deletions inlong-sdk/dataproxy-sdk/src/main/resources/sdk.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=${project.version}
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading