【发布时间】:2017-12-17 10:38:35
【问题描述】:
我正在使用 jgitver library 使用 Git 存储库的状态自动生成 semver。
我有一个多模块项目,其中模块是相互依赖的,这意味着如果我对一个模块进行更改,那么其他模块应该开始引用更改后模块的新版本。
所有模块都在同一个 Git 存储库中,因此 Git 中的任何更改都会更改所有模块的版本。以下是我的项目结构示例
.git (Common repository)
module1
common-module
pom.xml (Parent POM)
以下是我如何包含依赖模块的示例
<-- POM of module1, includes common-module-->
<dependency>
<groupId> com.test</groupId>
<artifactId>common-module</artifactId>
<version>1.0.0</version> <!-- version generated by jgitver -->
</dependency>
由于jgitver 生成的任何时候版本对于module1 和common-module 都是相同的,因为它们位于同一个 Git 存储库中,我不想在所有模块中对版本进行硬编码。好像版本发生了变化,那么我将不得不手动更改所有模块中 common-module 依赖项的版本。
是否有像${project.version} 这样的变量可以用来引用jgitver 生成的当前版本?
我希望如下配置module1
<dependency>
<groupId> com.test</groupId>
<artifactId>common-module</artifactId>
<version>${JGITVER_GENERATED_VERSION_VARIABLE}</version> <!-- version generated by jgitver -->
</dependency>
【问题讨论】: