Why does my build runs from the command line but not in Bamboo?
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The build runs successfully from the command line (Terminal/Dos/Shell etc) but not when triggered in a Bamboo build context.
Cause
The major difference between the command line execution and triggering the build in Bamboo is the system environment for Bamboo versus a user's shell environment:
The User/Environment
Bamboo may be run under as a different user
Check the output of the
set
(Windows) orenv
(Linux) commands and review the differences between a working and a failed run
Maven or Ant Builder - Bamboo will use the version selected by the builder and set the
M2_HOME/ANT_HOME
variable.JDK - see Builder
The selected JDK may be different for the command line and Bamboo (plan), run
java -version
to check for the JDK version
Solution
Be logged in as the same user that runs Bamboo Server or the Bamboo Agent
Change your location to Bamboo's working copy
<bamboo-home>/xml-data/build-dir/PLAN-KEY
(Bamboo Remote and Elastic Agents or Bamboo Server 7.x and earlier) or<bamboo-home>/local-working-dir/PLAN-KEY
(Bamboo 8.x or later, Local Agent) and execute the exact command line as seen in the Bamboo build log from the command lineDepending on the type of task you are running, Bamboo may not show the exact line to use in the logs; if that happens, run the same plan again in Verbose mode (Run → Run Customized → Verbose Mode) to have more details on the command Bamboo is attempting to run
Was this helpful?