Manipulating environmental variables

This recipe shows you how to pass variables from Jenkins to your build job, and how different variables are overwritten. It also describes one way of failing the build if crucial information has not been correctly passed.

In a typical development/acceptance/production environment, you will want to keep the same pom.xml files, but pass different configuration. One example is the extension names of property files such as .dev, .acc, and .prd. You would want to fail the build if critical configuration values are missing due to human error.

Jenkins has a number of plugins for passing information to builds, including the EnvFile plugin ( and the EnvInject ...

Get Jenkins Continuous Integration Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.