I have bunch of projects. All of them must have the same version = branch directory name("7.15.0" for example).
To achieve that, i make one parent pom with code:
<version>${branch}</version>
<properties>
<branch>${project.file.parentFile.parentFile.parentFile.name}</branch>
</properties>
Most of my projects and subprojects are in directories, where ../.. is branch directory. Their poms contains this:
<parent>
<groupId>parentPomGroupId</groupId>
<artifactId>parentPomArtifactId</artifactId>
<version>${branch}</version>
</parent>
But not all projects is on the same level, so i must control and check where they is, and if needed add to their pom correct branch path:
<properties>
<branch>${project.file.parentFile.parentFile.name}</branch>
</properties>
also when project builds, in the log i see :
[INFO] Building appcore-utils ${project.file.parentFile.parentFile.name}
If i set constant in branch - log contains version. Tell me please, how can i resolve property "branch" only once in my parent pom? So if i use ${branch} in child project, it resolves to constant, which already calculated in parent pom. Or maybe there is another way to use branch directory name in version of projects?