title: Why does ant build fail with sudo even though it succeeds when run as root user?
body: <p>I am compiling an Android app on server with java build tool ant. </p>
  
  <p>When I run the following as root user the build succeeds:</p>
  
  <pre><code>export ANT_HOME=/usr/local/ant
  export JAVA_HOME=/usr/local/jdk
  export PATH=${PATH}:${ANT_HOME}/bin
  cd /path/to/android/file
  /usr/local/ant/bin/ant release
  </code></pre>
  
  <p>However, when I run the following as netuser (or any other user which I've tested):</p>
  
  <pre><code>export ANT_HOME=/usr/local/ant
  export JAVA_HOME=/usr/local/jdk
  export PATH=${PATH}:${ANT_HOME}/bin
  cd /path/to/android/file
  sudo /usr/local/ant/bin/ant release
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>BUILD FAILED
  /path/to/android/file/build.xml:83: The following error occurred while executing this line:
  /usr/share/android-sdk/tools/ant/build.xml:206: Class org.apache.tools.ant.taskdefs.condition.And doesn't support the nested "matches" element.
  </code></pre>
  
  <p>I have tried changing sudoers file to even give netuser all permissions with netuser ALL=(ALL) ALL but I get same results... Can someone tell me what I am doing wrong?</p>
  
  <p>Thanks in advance for any help.</p>