maven picking up environment variable set by jenkins

I am using the following maven pom.xml snippet to read a property called BUILD_NUMBER from a file jenkins/


Jenkins also has an environment variable called $BUILD_NUMBER. I have child pom.xmls which try and use the $BUILD_NUMBER, and it keeps picking up the Jenkins environment variable value for $BUILD_NUMBER instead of the one from jenkins/ I am just wondering if maven puts values it reads from files into the environment? If so, it looks as though Jenkins is over writing this value…

  • Jenkins unable to find valid certification path to requested target error while importing Git repository
  • Can I use git command in delivery pipeline if git is installed in different path on jenkins agent than on master
  • ERROR: Error cloning remote repo 'origin'
  • how to get $CAUSE in workflow
  • Create Jenkins Docker Image with pre configured jobs
  • How to run GUI tests on a jenkins windows slave without remote desktop connection?
  • Maven m2e-egit install failure under Kepler
  • jenkins trigger build if new tag is released
  • Jenkins git plugin: How to configure different fetch and push git remotes?
  • Email notification for subversion polling failures in Jenkins
  • How to shutdown my Jenkins safely?
  • Spread load evenly by using ‘H * * * *’ rather than ‘5 * * * *’
  • 2 Solutions collect form web for “maven picking up environment variable set by jenkins”

    What makes you think ${project.parent.basedir} evaluates to anything useful?

    I’d say your <file> points to a non-existing file, so the properties-maven-plugin does not read any properties, so BUILD_NUMBER is not defined as a property, and ${BUILD_NUMBER} falls back to ${env.BUILD_NUMBER}, which is your Jenkins environment variable.

    I changed the BUILD_NUMBER variable to a different name so that it didn’t clash with the Jenkins $BUILD_NUMBER environment variable. That seems to have fixed the problem. Thanks for the help – set me on the right track.

    Git Baby is a git and github fan, let's start git clone.