spring-doc / comments

springdoc.cn comments
0 stars 0 forks source link

https://springdoc.cn/spring-boot-build-with-git-commit-id-maven-plugin/ #16

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

Spring Boot 使用 git-commit-id-maven-plugin 打包应用 - spring 中文网

本文介绍了如何使用 git-commit-id-maven-plugin maven 插件,在打包 Spring Boot 应用时把 git-commit 信息打包到 Jar 中

https://springdoc.cn/spring-boot-build-with-git-commit-id-maven-plugin/

Naylor55 commented 3 months ago

includeOnlyProperties 可选项

示例:


<!--  git-commit-id-maven-plugin :打包的时候携带git提交信息  -->
<plugin>
    <groupId>io.github.git-commit-id</groupId>
    <artifactId>git-commit-id-maven-plugin</artifactId>
    <version>5.0.0</version>
    <executions>
        <execution>
            <id>get-the-git-infos</id>
            <goals>
                <goal>revision</goal>
            </goals>
            <phase>initialize</phase>
        </execution>
    </executions>
    <configuration>
        <generateGitPropertiesFile>true</generateGitPropertiesFile>
        <generateGitPropertiesFilename>${project.build.outputDirectory}/git.json
        </generateGitPropertiesFilename>
        <includeOnlyProperties>
            <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
            <includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
            <includeOnlyProperty>^git.branch</includeOnlyProperty>
            <includeOnlyProperty>^git.commit.user.name</includeOnlyProperty>
            <includeOnlyProperty>^git.commit.user.email</includeOnlyProperty>
        </includeOnlyProperties>
        <commitIdGenerationMode>full</commitIdGenerationMode>
    </configuration>
</plugin>