-2

I am having one pom.xml and I am building maven project in Jenkins. I want to print stuff like: Artifactid, Version, group ID. Which is present in pom.

I want to do it Jenkins itself without any plugins. Any help would be appreciated.

rKSH
  • 39
  • 9

1 Answers1

1

You can do this with the maven help plugin. Just use a "Execute Shell" Build Blog and write some bash code like this:

version=$(mvn help:evaluate -Dexpression=project.version | egrep -v "INFO|WARNING|ERROR")
echo $version

You can also check the topic How to get Maven project version to the bash command line for more possible solutions.

Community
  • 1
  • 1
mszalbach
  • 10,612
  • 1
  • 41
  • 53
  • thanks for the reply @mszalbach. but is it possible to print without any plugin? – rKSH Oct 10 '16 at 09:56
  • This is just a maven plugin no need to install anything works directly from the command line since maven will take care how to get the plugin. Else use some complicated greps or use some interpreter language like python which have better xml support. – mszalbach Oct 10 '16 at 10:00