How do I Extract Version ID from POM inside Jenkins Declarative and Scripted pipelines?

Use readMavenPom like this:

pom = readMavenPom file: 'pom.xml'
pom.version

See Model reference for properties (like the above version).

For this to work, one has to install Pipeline Utility Steps plugin

Leave a Comment