修复git信息丢失, #2053
This commit is contained in:
21
pom.xml
21
pom.xml
@@ -448,13 +448,22 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<groupId>io.github.git-commit-id</groupId>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<artifactId>git-commit-id-maven-plugin</artifactId>
|
||||||
<version>4.9.10</version>
|
<version>9.0.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>get-the-git-infos</id>
|
||||||
|
<goals>
|
||||||
|
<goal>revision</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>initialize</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<offline>true</offline>
|
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||||
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
|
||||||
<dateFormat>yyyyMMdd</dateFormat>
|
<commitIdGenerationMode>full</commitIdGenerationMode>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.utils;
|
package com.genersoft.iot.vmp.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -7,6 +8,7 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* 一个优秀的颓废程序猿(CSDN)
|
* 一个优秀的颓废程序猿(CSDN)
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
@Component
|
@Component
|
||||||
@PropertySource(value = {"classpath:git.properties" }, ignoreResourceNotFound = true)
|
@PropertySource(value = {"classpath:git.properties" }, ignoreResourceNotFound = true)
|
||||||
public class GitUtil {
|
public class GitUtil {
|
||||||
@@ -29,31 +31,4 @@ public class GitUtil {
|
|||||||
@Value("${git.commit.time:}")
|
@Value("${git.commit.time:}")
|
||||||
private String commitTime;
|
private String commitTime;
|
||||||
|
|
||||||
public String getGitCommitId() {
|
|
||||||
return gitCommitId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBranch() {
|
|
||||||
return branch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGitUrl() {
|
|
||||||
return gitUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBuildDate() {
|
|
||||||
return buildDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCommitIdShort() {
|
|
||||||
return commitIdShort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBuildVersion() {
|
|
||||||
return buildVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCommitTime() {
|
|
||||||
return commitTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user