title: How to get Jenkins working with binaries from COMPOSER_HOME/bin?
body: <p>I'm working on a project and want to use Jenkins for it. The config should be done by a simple <code>build.xml</code> with a fiew targets:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project name="MyProject" default="full-build"&gt;
      &lt;property name="phpcs"   value="phpcs"/&gt;
      &lt;property name="phpdox"  value="phpdox"/&gt;
      &lt;target name="full-build" depends="lint, phpdox" description="Performs static analysis, runs the tests, and generates project documentation"/&gt;
      &lt;target name="lint" description="Perform syntax check of sourcecode files"&gt;
          &lt;apply executable="php" taskname="lint" failonerror="true"&gt;
              &lt;arg value="-l" /&gt;
              &lt;fileset dir="${basedir}/module/"&gt;
                  &lt;include name="**/*.php" /&gt;
              &lt;/fileset&gt;
              &lt;fileset dir="${basedir}/phpunit/tests"&gt;
                  &lt;include name="**/*.php" /&gt;
              &lt;/fileset&gt;
          &lt;/apply&gt;
      &lt;/target&gt;
      &lt;target name="phpdox" description="Generate project documentation using phpDox"&gt;
          &lt;exec executable="${phpdox}" dir="${basedir}/ci/phpdox" taskname="phpdox"/&gt;
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The PHP Lint (<code>php -l</code>) job works perfectly:</p>
  
  <p><strong>Console Output</strong></p>
  
  <pre><code>Started by user anonymous
  Building in workspace D:\Data\myproject
   &gt; git.exe rev-parse --is-inside-work-tree # timeout=10
  Fetching changes from the remote Git repository
   &gt; git.exe config remote.origin.url https://github.com/MyAccount/MyProject.git # timeout=10
  Fetching upstream changes from https://github.com/MyAccount/MyProject.git
   &gt; git.exe --version # timeout=10
  using .gitcredentials to set credentials
   &gt; git.exe config --local credential.username myusername # timeout=10
   &gt; git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git8298647783094567497.credentials\" # timeout=10
  Setting http proxy: my.proxy.tld:8080
   &gt; git.exe -c core.askpass=true fetch --tags --progress https://github.com/MyAccount/MyProject.git +refs/heads/*:refs/remotes/origin/*
   &gt; git.exe config --local --remove-section credential # timeout=10
   &gt; git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
   &gt; git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
  Checking out Revision 54af2180160f47d518c42f58f56cba175ca2ee39 (refs/remotes/origin/master)
   &gt; git.exe config core.sparsecheckout # timeout=10
   &gt; git.exe checkout -f 54af2180160f47d518c42f58f56cba175ca2ee39
   &gt; git.exe rev-list 54af2180160f47d518c42f58f56cba175ca2ee39 # timeout=10
  [myproject] $ cmd.exe /C '"ant.bat &amp;&amp; exit %%ERRORLEVEL%%"'
  Buildfile: D:\Data\myproject\build.xml
  
  lint:
       [lint] No syntax errors detected in D:\Data\myproject\module\Application\Module.php
       ...
       [lint] No syntax errors detected in D:\Data\myproject\phpunit\tests\Application\DummyTest.php
  </code></pre>
  
  <p>But the executing of PHPDox is failing:</p>
  
  <pre><code>phpdox:
  
  BUILD FAILED
  D:\Data\myproject\build.xml:18: Execute failed: java.io.IOException: Cannot run program "phpdox" (in directory "D:\Data\myproject\ci\phpdox"): CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      at java.lang.Runtime.exec(Runtime.java:620)
      at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
      at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
      at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
      at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
      at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
      at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:435)
      at org.apache.tools.ant.Target.performTasks(Target.java:456)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
      at org.apache.tools.ant.Main.runBuild(Main.java:853)
      at org.apache.tools.ant.Main.startAnt(Main.java:235)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
  Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessImpl.create(Native Method)
      at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:386)
      at java.lang.ProcessImpl.start(ProcessImpl.java:137)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      ... 24 more
  
  Total time: 8 seconds
  Build step 'Invoke Ant' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>The same problem I have with other Composer packages, that are installed <a href="https://getcomposer.org/doc/03-cli.md#global" rel="nofollow">globally</a> and used from <code>COMPOSER_HOME/bin</code> (e.g. PHP_Codesniffer).</p>
  
  <p>I've tried to define the commands in another way (like <code>&lt;exec executable="cmd"&gt;&lt;arg line="/c phpdox ..." /&gt;&lt;/exec&gt;</code>), but it's also not working.</p>
  
  <p>The direct executing of the <code>build.xml</code> with <code>ant</code> works.</p>
  
  <p>The environment variable for the Composer is set correctly -- I can call the tools via the CLI (CMD or GitBash/MinGW). So the problem must have been caused by something else. What can it be?</p>
  
  <p><strong>How to get Jenkins working with packages installed globally via Composer?</strong></p>