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

Plugin Information

View batch task on the plugin site for more information.

This plugin adds batch tasks that are not regularly executed to projects, such as releases, integration, archiving, etc. In this way, anyone in the project team can execute them in a way that leaves a record.


When you install this plugin, your project configuration page gets additional "batch tasks" option as illustrated below:

A batch task consists of a shell script and a name. When you execute a build, the shell script gets run on the workspace, just like a build. Batch tasks and builds "lock" the workspace, so when one of those activities is in progress, all the others will block in the queue.

Once a task is configured, the project top page gets "task(s)" link, as illustrated below:

If you click that, you can see the status of all the tasks. You can schedule the execution of a task from here, too. Task executions are numbered like "123-456" where 123 portion refers to the latest build and 456 portion refers to the sequential number (so that you can execute a task multiple times with the same build.) The build number portion is significant because when a batch task runs, it sees the workspace as of the result of this build.

The details of the task execution and its console output are available by further clicking a task of the interest, as below:

Change Log

Version 1.19 (Jul. 1, 2016)

Version 1.18 (Jun. 7, 2016)

Version 1.17 (Fev. 24, 2013)

  • Fix reopened JENKINS-13647 - Environment variables from EnvInject plugin are not inherited/parsed by batch tasks

Version 1.16 (May 1, 2012)

  • Fix JENKINS-13647 - Environment variables from EnvInject plugin are not inherited/parsed by batch tasks

Version 1.15 (Apr 5, 2012)

Version 1.14 (Nov 11, 2010) - requires Hudson 1.383+

  • Fixed an AbstractMethodError when running with Hudson 1.383+ (issue #8033)

Version 1.13 (Feb 10, 2010)

Version 1.12 (Feb 5, 2010)

  • Lock workspace during task run to prevent owner project or other tasks from using the same workspace. (JENKINS-5285)
  • Show animated ball icon for Tasks link in sidepanel when a task is running. (JENKINS-3372)

Version 1.11 (Jan 3, 2010)

Version 1.10 (Dec 7, 2009)

  • A few minor bug fixes.

Version 1.9 (Nov 5, 2009)

  • Add "trigger even if build is unstable" selector for invoking tasks as a post-build action. Previously the tasks were always invoked (even for failed builds); now they will only run if the build result meets the required threshold (and never for failed builds).
  • Fix build number written to job log when task is invoked as a post-build action (was off by one)
  • Fix broken image for aborted task (grey ball)
  • On task page, show only builds for this task in Build History (instead of all tasks)
  • Avoid error if try to run a task when there are no builds for the project

Version 1.8 (Aug 28, 2009)

  • Improved the error diagnosis and recovery when a build no longer has a workspace (report) – requires Hudson 1.319 or higher.

Version 1.7 (Mar 31, 2009)

  • Allow non-admin users ability to manage and execute tasks (JENKINS-1198)

Version 1.6 (Feb 27, 2009)

  • Updated to work with recent versions of Hudson (JENKINS-3173)

Version 1.5 (Jan 27, 2009)

  • Fixed a bug "batchtask in queue causes NPE at startup" (JENKINS-2925)

Version 1.3 (Jan 29, 2008)

  • Updated to work with the latest version of Hudson, so that it won't cause AbstractMethodError (report)
  • Last successful/failed builds were computed incorrectly (JENKINS-1012)
  • Icon size in task list is now configurable (JENKINS-1010)

Version 1.2 (Nov 16, 2007)

  • Task can be now individually deleted from the left menu
  • Build number should start from 1 (JENKINS-991)
  • Tasks now work on Windows (JENKINS-985)
  • Build icon in task list is not larger than the other icons (JENKINS-1010)

Version 1.0 (Oct 18, 2007)

  • initial version


  1. Unknown User (fabrice@xeberon.net)

    Ok nice but only admin role can execute batch task ! So it is not anyone.

    Should I opened a issue on jira ?

  2. Unknown User (wbatelaan)

    I'm confused about this plugin - I don't see its usefulness, since it seems to do what the locks plugin does

    ( http://hudson.gotdns.com/wiki/display/HUDSON/Locks+and+Latches+plugin ).

    And the tasks it allows to create are less flexible than the tasks in a normal job.

    How do the batch plugin tasks relate to the normal tasks that a job performs?

    Do they run before, after, or in paralel?

    1. Unknown User (purnank@gmail.com)

      Hi Wouter,

      This plug-in allows to have jobs to be executed in isolation!
      It helps for the jobs that are not executed very frequently, or at-least not nightly!

      The jobs are just a "click" away!


  3. Unknown User (jbrook)

    Is it possible to use this plugin to execute tasks against builds that are not the latest build? It would seem useful to be able to select a build from the build history and then have a 'tasks' link to run tasks for that particular build, for example a 'release/deploy' task. You don't always want to deploy the most recent build. --James

    1. Unknown User (marvix)

      Hi James.

      This would be very useful to me too. As it seems that after 3 years the plugin didn't get the new feature, did you find any workaround for this?

      Thanks, Marvix

  4. Unknown User (shibug)

    This plugin is causing Hudson (v1.285) to crash with the following exception:
    javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/ACN/app/jboss/server/ci/tmp/deploy/tmp41576hudson-exp.war/WEB-INF/lib/hudson-core-1.285.jar!/lib/hudson/queue.jelly:60:62: <j:set> java.lang.IncompatibleClassChangeError

  5. Unknown User (jpatterson)

    Here is an idea for enhancement of this plugin: Make the batch tasks plugin have the same functionality as the "This build is parameterized" checkbox in the configuration page of the projects. It would be best if each individual task had its own per task "This task is parameterized" checkbox. However it would still be helpful if there was a single "These tasks are parameterized" checkbox for all the tasks to share. In either case, when a parameterized task is executed, the parameters would asked for and the values of the parameters would be setup as environment variables that are available for the tasks to use. With this functionality, tasks could be written to do almost anything to the workspace independent of the last build of the project.

    1. Unknown User (adamarmistead)

      I totally second this idea.  This would be quite helpful.  I am looking for a way to deploy my project and prompt for the software version number for the deployment, and this idea would fit that nicely.

      1. Unknown User (kalpeshsoni)

        +1 for paramerterizing batch builds

        koshuke where are thou?

  6. Unknown User (benjwarneranz)

    When a user kicks off a task, it would be great to have their username available in an environment variable.  I've used the tasks plugin to trigger all our deployment tasks.  We record in a database who did each deployment, so at the moment user the tasks plugin, the "user" is an unknown.  This is raised as issue #1628, but just thought I'd vote for it here as well.  (smile)

  7. Unknown User (krischan83)

    First, this plugin is great!

    What I miss a bit is: global environment properties (set in Hudson main configuration) are not available to the batch task. But that's not a crucial issue for me. More a nice-to-have.


  8. Unknown User (jamesclinton)

    Great plugin. Thanks.

    Feature request:

    It would be great if the task history could be visible for a past Job. 

    The tasks history is currently refreshed after building the job, so someway of getting this for a previous job would be useful.

    Hope that's clear.

  9. Unknown User (doug.borg@integware.com)

    This plugin is great!

    I second James' feature request above, and would like to add my own:

    Would it be possible to allow batch tasks to run on a scheduled basis?

    I have indexing jobs that I would like to run as a batch task for the deployment jobs they are related to. Currently, I have separate jobs in Hudson that check out the same workspace as the deployment job and I would like to avoid this if possible. It would also be nicer if it was a batch task because then I could directly relate the indexing runs to the deployment "build" number and not run the indexing jobs while the deployment job is running. Right now my indexing jobs just fail while the deployment is actually running. I hope this makes sense; please let me know if you have any questions or suggestions for other ways of accomplishing this.

    Also, please let me know if there is a more appropriate place to request features for plugins than the plugin wiki page.

    Thanks again!

  10. Unknown User (hugo.monteiro@nsn.com)

    Hi there,

    Thanks for this plugin, it's very useful.

    I have a feature request and a "bug"(?) issue for it:

    1) Bug(?): "Task" Menu should show every time if there are tasks configured and/or tasks defined for execution for the job.
    "Task" Menu isn't shown if there are no tasks configured in the current job, although there are tasks defined for execution (invoke batch tasks) in job's configuration, provided from a different job.

    2) Feature Request: It would be nice that the fields in the job's configuration section "Invoke batch tasks" could be automatically updated when entering a value (mimicking the behavior hudson has when creating a new Job by copying an existing job, when entering values in "copy from field"). Currently, one has to enter the job's name in the "Project field", save the job, and returning to configuration to be able to see all related tasks from the previously specified job.


  11. Unknown User (ndierauf)

    Any chance that the task name can be exposed as an environment variable?


  12. Unknown User (vivekr)


    I have some problems with batch tasks, its failing to excute the task

    Hudson ver. 1.354 Plugin: 1.13

    Task: echo hello

    Test-BuildConf $ cmd /c call C:\WINDOWS\TEMP\hudson25025.bat
    The directory name is invalid
    FATAL: command execution failed
    [8mha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mjava.io.IOException: Cannot run program "cmd" (in directory "d:\hudson\workspace\Test-BuildConf"): CreateProcess error=267, The directory name is invalid
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at hudson.Proc$LocalProc.<init>(Proc.java:149)
    at hudson.Proc$LocalProc.<init>(Proc.java:121)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:633)
    at hudson.Launcher$ProcStarter.start(Launcher.java:268)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:778)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:754)
    at hudson.remoting.UserRequest.perform(UserRequest.java:114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:270)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 15 more

    but it works fine on a different system with same version

    1. Unknown User (tietyt)

      I think I have a related problem here. I named my project from "AppName" to "App Name" but the batch tasks are still trying to execute the script in the old path so it can't find the script.

      Here's the exception:
      workspace $ /bin/sh -xe /tmp/hudson3200245917642124053.sh
      FATAL: command execution failed
      [8mha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mjava.io.IOException: Cannot run program "/bin/sh" (in directory "/opt/hudson/jobs/AppName/workspace"): java.io.IOException: error=2, No such file or directory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
      at hudson.Proc$LocalProc.<init>(Proc.java:149)
      at hudson.Proc$LocalProc.<init>(Proc.java:121)
      at hudson.Launcher$LocalLauncher.launch(Launcher.java:638)
      at hudson.Launcher$ProcStarter.start(Launcher.java:273)
      at hudson.Launcher$ProcStarter.join(Launcher.java:280)
      at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:83)
      at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
      at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:295)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:124)
      Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
      at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
      at java.lang.ProcessImpl.start(ProcessImpl.java:65)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
      ... 10 more

  13. Unknown User (robig)


    Is it possibe to do a Task before any other operation, also before the SCM plugin?

    We're using a svn mirror to checkout, but switching to main repo to do some commits. To use the advantage of updating the working copy, we have to switch back to the main repo. But in a batch task it will only switch on successful and unstable build.

    thanks for your plugin, its very useful for release purposes.


  14. Unknown User (indrg)

    I am trying to setup a job that will invoke batch task of another project in Post-Build Action. How do I pass to batch task (Downstream Tasks) parameters?

    Thank you,