Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata


This plugin has been deprecated. Please use the https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin to set an environment.
Be careful: EnvInject plugin migrates automatically the Setenv plugin configuration. There are no back procedures after the migration.

Set environment variables for a project, to be referenced during build steps.

This plugin adds a section to job configuration pages for specifying key/value pairs of environment variables. These environment variables will be available to build steps in both freestyle and Maven projects, including the Ant, Maven, shell, and batch steps in freestyle projects.


Version 1.2 (08/14/2011)
  • Removed unused help files
Version 1.1 (12/28/2009)
  • Fix help link
Version 1.0 (9/29/2009)
  • Initial release.


  1. Unknown User (schtefan)

    Providing environment variables for a build is already realized by the (Hudson core) job option "This build is parameterized" (see Parameterized Build). What is the difference between your plugin and the core functionality?

    1. Unknown User (stigkj)

      If you want a build to start automatically, like from an SCM or a dependency change, you cannot use parameterized builds. Then this plugin is very good to have. In my case, I have some GUI tests that need an X11 display. As I have a cluster, it is very nice to just set the X11 display env.var. with this plugin and not have to do this for every node.

  2. Unknown User (clanjava@gmail.com)

    Is it possible to extend this to include "Post Build Actions" as well? Reason being is that we have clear case stream views that change everytime a new stream is created (about once a month). Currently i have to go into every single config area and update the new stream path , for example where the ant script is and in the Post Build in the Archive Area where I want to change where the artifacts will be.

    1. Unknown User (gbois)

      The environment variables sets by the setEnv plug-in (or other similar plugin : envfile and envInject) are available in post-build actions.
      However, for the clearcase plugin is a special case. The clearcase streams/baselines are display in the post-build actions section but they are executed in the prebuild method from the job lifecycle.
      I suggest using the EnvInject plugin (https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin). It meets your needs and performs injection of environment variables before any job operations.

  3. Unknown User (erds)

    I'm attempting to use the plugin to set variables based on other environmental variables. i.e.

    CONTAINER = $WORKSPACE\container



    How should I do this?


    1. Unknown User (erds)

      Figured it out:


      I was missing the braces and double backslash (I'm assuming this is escaped??)

      1. Unknown User (carl.quinn@gmail.com)

        Try using forward slash instead of double backslash. That should work on Unix as well as Windows.

        Unknown macro: {WORKSPACE}


  4. Unknown User (jl.pinardon)

    It seems that the plugin cannot be used to pass parameter from an upstream to a downstream job. I mean from a job which triggers another one when it successfully ends.
    Am I true, or have I missed something ?

    1. Unknown User (gbois)

      You're right. To pass parameters from the upstream job to the downstream job, you have to use the Parameterized Trigger Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin).

  5. Unknown User (phillipoldham)

    Its also not possible to create "dynamic" vars - i.e. calculate them at the point of creation:

    TAG_ID=`date +%y.%m.%d.$SVN_REVISION`

    This would be a very handy feature.

    1. Unknown User (gbois)

      I agree. It will be an handy feature but we will have difficulty providing that in a suitable way.
      However, I suggest using the envInject plugin (https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin).
      With this plugin, you can set this variable by executing a shell script (or a batch script in your case) at the set up of the job, fill in a Java properties file with this variable (and other) and the computed value. Then, you can inject properties in this new file as environment variables in a build step. With this configuration, you are able to use these environment variables in other build steps and in post-actions.

  6. Unknown User (axel.heider@gi-de.com)

    What is the difference to the ToolEnvironment Plugin. It appears both do more or less the same.

    1. Unknown User (gbois)

      SetEnv plugin or other equivalent plugins (envfile or envInject plugins) makes it possible to add (or replace) environment variables.
      ToolEnvironment plugin enables users to use logic names from location tools defined in the main page as environment variables.

  7. Unknown User (tjurik)

    I am unable to successfully use the env vars I create in the subsequent email. 

    I try both $VARNAME and "$

    Unknown macro: {VARNAME}


    and neither get substituted.  Am I out of luck with sending the emails?

    (I use this for a single place to set a version number and it works fine int he batch processes but no good in the emails)

    1. Unknown User (gbois)

      Could you raise an issue and attach your job configuration file (config.xml)?

  8. Unknown User (geronimo)

    Where is the source code for this plugin?

    1. Unknown User (gbois)

      The source code location has changed.

      The new location is https://github.com/jenkinsci/setenv-plugin

  9. Unknown User (marc_guenther)

    Could you add to the deprecation warning, that the new plugin actually migrates the existing configuration of this plugin. Very nice feature that, if only you would know it.

    1. Unknown User (gbois)