I want to read the version that is used by the parent of my application.
I try to write the version dynamically in the pom
of the child.
Thank you for your suggestions.
I want to read the version that is used by the parent of my application.
I try to write the version dynamically in the pom
of the child.
Thank you for your suggestions.
You don't have to set version on a child pom since it inherits its parent version.
On the example below, the bar-child project inherits the 1.0 version attribute from it's parent bar:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.foo.bar</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
</parent>
<artifactId>bar-child</artifactId>
</project>
By the way, along the child pom configuration you can always type ${project.version} to reference the version number, which, as explained before, will be the same version as it's parent (1.0).
Check https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance for more information.