git-commit-id-plugin 在 Jenkins 构建期间不在类路径中生成 git.properties

问题描述

我在我的 maven pom 文件添加了以下依赖项和构建插件

<dependency>
           <groupId>pl.project13.maven</groupId>
           <artifactId>git-commit-id-plugin</artifactId>
           <version>3.0.0</version>
</dependency>

<plugin>
               <groupId>pl.project13.maven</groupId>
               <artifactId>git-commit-id-plugin</artifactId>
               <version>3.0.0</version>
               <configuration>
                   <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                   <prefix>git</prefix>
                   <verbose>false</verbose>
                   <generateGitPropertiesFile>true</generateGitPropertiesFile>
                   <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                   <format>json</format>
               </configuration>
</plugin>

当我从在 Windows 上运行的本地机器进行 maven 构建时,它会在我的本地生成 git.properties。但是在通过 Jenkins 构建运行时,相同的配置没有在类路径中创建 git.properties,因此引用 rest-controller 的 git commit 无法解析注释值。

如果在这里发现为什么 git.properties 不是通过我的 Jenkins 构建创建的,我们将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)