maven打包时如何在MANIFEST.MF文件中增加Git相关信息

我想在打包jar时在MANIFEST.MF文件中加入git分支信息,打包人,需要怎么配置?

现在这样的,并没有git信息,只有打包时间

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <timestampFormat>yyyy-MM-dd HH:mm:ss</timestampFormat>
                    <timestampPropertyName>buildTime</timestampPropertyName>
                </configuration>
                <executions>
                    <execution>
                        <id>create-timestamp</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create-timestamp</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-buildNumber</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <!--如果git仓库地址为 http/https-->
                            <scmConnectionUrl>scm:git:https://xxx.git</scmConnectionUrl>
                            <username>819048836@qq.com</username>
                            <password>xxx</password>

                            <!--<scmConnectionUrl>scm:git:git@gitlab.lab.com/ms.git</scmConnectionUrl>-->
                            <shortRevisionLength>8</shortRevisionLength>
                        </configuration>
                    </execution>
                </executions>
                <inherited>false</inherited>
            </plugin>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifestEntries>      <!--suppress UnresolvedMavenProperty -->
                        <Build-Time>${buildTime}</Build-Time>
                    </manifestEntries>
                </archive>
            </configuration>
阅读 2.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题