当前位置: 首页 > news >正文

长春市长春网站建设网国外搜索引擎大全不屏蔽

长春市长春网站建设网,国外搜索引擎大全不屏蔽,wordpress安装主体,wordpress赞赏SpringBoot 启动输出 Git 版本信息 文章目录 SpringBoot 启动输出 Git 版本信息1. 环境依赖2. pom.xml 配置3. 启动类配置 为了方便记录项目打包时的 Git 版本,本文将介绍如何将 Git 版本信息打包进 JAR 文件,并在项目启动时输出。 1. 环境依赖 SpringB…

SpringBoot 启动输出 Git 版本信息

文章目录

  • SpringBoot 启动输出 Git 版本信息
    • 1. 环境依赖
    • 2. pom.xml 配置
    • 3. 启动类配置

为了方便记录项目打包时的 Git 版本,本文将介绍如何将 Git 版本信息打包进 JAR 文件,并在项目启动时输出。

1. 环境依赖

  • SpringBoot 2.7.13;
  • git-commit-id-maven-plugin 4.9.9;

2. pom.xml 配置

<build><plugins><plugin><groupId>io.github.git-commit-id</groupId><artifactId>git-commit-id-maven-plugin</artifactId><version>4.9.9</version><executions><execution><id>get-the-git-infos</id><goals><goal>revision</goal></goals><phase>initialize</phase></execution></executions><configuration><injectAllReactorProjects>false</injectAllReactorProjects><verbose>true</verbose><skipPoms>true</skipPoms><generateGitPropertiesFile>true</generateGitPropertiesFile><generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename><generateGitPropertiesFileWithEscapedUnicode>false</generateGitPropertiesFileWithEscapedUnicode><dotGitDirectory>${project.basedir}/.git</dotGitDirectory><format>properties</format><prefix>git</prefix><dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat><dateFormatTimeZone>${user.timezone}</dateFormatTimeZone><failOnNoGitDirectory>false</failOnNoGitDirectory><failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo><useNativeGit>false</useNativeGit><skip>false</skip><runOnlyOnce>false</runOnlyOnce><commitIdGenerationMode>full</commitIdGenerationMode><evaluateOnCommit>HEAD</evaluateOnCommit><useBranchNameFromBuildEnvironment>true</useBranchNameFromBuildEnvironment><injectIntoSysProperties>true</injectIntoSysProperties><offline>true</offline></configuration></plugin></plugins>
</build>

3. 启动类配置

package com.xiaoqqya.gitinfo;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.info.GitProperties;
import org.springframework.context.ConfigurableApplicationContext;/*** Spring boot git info demo.** @author <a href="mailto:xiaoQQya@126.com>xiaoQQya</a>* @since 2023/07/11*/
@SpringBootApplication
public class GitInfoApplication {private static final Logger LOGGER = LoggerFactory.getLogger(GitInfoApplication.class);public static void main(String[] args) {ConfigurableApplicationContext context = SpringApplication.run(GitInfoApplication.class, args);printGitInfo(context);}/*** 输出 Git 版本控制信息.** @param context SpringBoot 上下文信息*/private static void printGitInfo(ConfigurableApplicationContext context) {try {if (LOGGER.isInfoEnabled()) {GitProperties gitProperties = context.getBean(GitProperties.class);LOGGER.info("Git branch: {}", gitProperties.get("branch"));LOGGER.info("Git build time: {}", gitProperties.get("build.time"));LOGGER.info("Git commit id: {}", gitProperties.get("commit.id.full"));LOGGER.info("Git commit user: {}", gitProperties.get("commit.user.name") + "<" + gitProperties.get("commit.user.email") + ">");LOGGER.info("Git commit time: {}", gitProperties.get("commit.time"));LOGGER.info("Git commit message: {}", gitProperties.get("commit.message.full"));}} catch (NoSuchBeanDefinitionException e) {LOGGER.warn(e.getMessage());}}
}

参考文章:

  • git-commit-id/git-commit-id-maven-plugin (github.com);
  • Injecting Git Information Into Spring Beans | Baeldung;
  • springboot获取项目git版本信息的几种方式_gitproperties_sky~hello的博客-CSDN博客;
http://www.hkea.cn/news/737470/

相关文章:

  • 网站整体营销方案网络营销的特点是什么?
  • 国内知名的网站建设公司有哪些百度指数专业版app
  • 画画外包网站如何推广一个网站
  • 互联网公司响应式网站深圳google推广
  • 深圳网站设计哪好什么推广平台比较好
  • 打开英文网站字体不对教程seo推广排名网站
  • 昭通市建设局网站太原百度关键词优化
  • 个人建网站允许吗seo职位要求
  • 环保网站设计网络营销优化推广
  • 网页设计网站制作公司冯耀宗seo视频教程
  • 怎么用路由器做网站百度指数平台官网
  • 济南做网站互联网公司有哪些seo是什么公司
  • 辛集seo网站优化价格许昌网站seo
  • 网站建设后期维护百度快速收录技术
  • 网站建设中的推广工作seo学校培训
  • 上海专业网站建设网百度搜索推广开户
  • 做学校网站素材图片合肥seo代理商
  • 真题真做报名网站淘宝搜索关键词排名
  • 免费的黄冈网站有哪些平台?培训行业seo整站优化
  • 寿县住房与城乡建设局网站真正免费的网站建站平台
  • 常德seo招聘网站seo站长工具
  • 网站开发多久完成俄罗斯搜索引擎yandex推广入口
  • 漳州做网站建设建网站免费
  • 网站建设服务上海广州软文推广公司
  • 做一个网站app需要多少钱web制作网站的模板
  • 网站建设的财务计划新媒体营销策略有哪些
  • 网站建设分金手指专业二八宁波品牌网站推广优化
  • 清远网站建设公司百度游戏风云榜
  • 网上可以自学什么技术win7系统优化软件
  • 嘉兴建站软件如何做好企业网站的推广