After we fetch POM model like described in Krzysztof Krasoń's answer in extract pom version in a jenkins pipeline. Call to pom.version returns the fully qualified name of the artifact and not just the version.
For example
@NonCPS
def version() {
pom = readMavenPom file: 'pom.xml'
pom.version
}
for
<groupId>com.test.app</groupId>
<artifactId>app</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
will produce
com.test.app:app:pom:1.0.0-SNAPSHOT
Is there a way to return just the version part from returned Model without doing any String manipulation?