mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
1、打包时自动生成版本信息及git提交信息;2、优化swagger对版本信息的获取
This commit is contained in:
@@ -114,7 +114,6 @@
|
||||
<build>
|
||||
<finalName>kafka-manager</finalName>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
@@ -126,7 +125,25 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
|
||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
|
||||
<format>json</format>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.xiaojukeji.kafka.manager.web.config;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.service.utils.ConfigUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.GitPropUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.*;
|
||||
@@ -22,9 +21,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@EnableWebMvc
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
private ConfigUtils configUtils;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
@@ -43,10 +39,13 @@ public class SwaggerConfig implements WebMvcConfigurer {
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
String version = GitPropUtil.getProps(GitPropUtil.VERSION_FIELD_NAME);
|
||||
String commitId = GitPropUtil.getProps(GitPropUtil.COMMIT_ID_FIELD_NAME);
|
||||
|
||||
return new ApiInfoBuilder()
|
||||
.title("LogiKM接口文档")
|
||||
.description("欢迎使用滴滴LogiKM")
|
||||
.version(configUtils.getApplicationVersion())
|
||||
.version(String.format("%s-%s", version == null? "": version, commitId == null? "": commitId))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user