0

I'm evaluating the jgitver Maven extension for calculating artefact versions from git metadata.

jgitver provides the commit datetime in a property called jgitver.head_commit_datetime, but I can't figure out how to include the timestamp in the version string.

Can anyone help?

4

2 回答 2

0

感谢 maven 惰性评估,您可以使用版本插件将它们提供到构建中,例如:

mvn jgitver versions:set -DnewVersion=1.0.\${jgitver.head_commit_datetime} versions.commit

试试看,让我知道。

它基本上将属性传递给versions:set插件,这会将所有pom文件重写为给定的新版本。

于 2017-11-09T12:12:13.600 回答
0

@otto.poellath,您可以使用配置属性useGitCommitTimestamp并将其设置为 true ;它仅在non mavenjgitver 模式下可用,因为它与严格的 maven SNAPSHOT 有点冲突。

因此,如果您的.mvn/jgitver.config.xml配置文件包含以下内容,它将起作用:

<mavenLike>false</mavenLike>
<useGitCommitTimestamp>true</useGitCommitTimestamp>

这是mvn validatejgitver-maven-plugin 本身使用这种配置的本地输出

H:\jgitver-maven-plugin>mvn validate
[INFO] using jgitver configuration file: H:\jgitver-maven-plugin\.mvn\jgitver.config.xml
[INFO] Scanning for projects...
[INFO] Using jgitver-maven-plugin [1.3.0] (sha1: ef8eec9f820d662e63a84f1210c377183e450cbd)
[INFO] jgitver-maven-plugin is about to change project(s) version(s)
[INFO]     fr.brouillard.oss::jgitver-maven-plugin::0 -> 1.3.1-20180710075533-integration
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jgitver Maven Plugin 1.3.1-20180710075533-integration
[INFO] ------------------------------------------------------------------------
...
于 2018-07-17T07:56:20.910 回答