我正在使用jgitver 库使用 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
相同的,因为它们在同一个 Git 存储库中,所以我不想在所有模块中对版本进行硬编码。好像版本发生了变化,那么我将不得不手动更改所有模块中的版本以获取依赖关系。module1
common-module
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>