title: How do I use Ant's DeployTask to deploy a Web application to Tomcat?
body: <pre><code>$ ant deploy
  Buildfile: /Users/simpatico/SOLR_HOME/build.xml
  
  deploy:
  
  BUILD FAILED
  /Users/simpatico/SOLR_HOME/build.xml:531: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fsolr
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
      at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:228)
  
  Total time: 2 seconds
  </code></pre>
  
  <p>In build.xml:</p>
  
  <pre><code>&lt;!--http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant--&gt;
    &lt;!-- Configure properties to access the Manager application --&gt;
    &lt;property name="url"      value="http://localhost:8080/manager"/&gt;
    &lt;property name="username" value="admin"/&gt;
    &lt;property name="password" value="admin"/&gt;
  
    &lt;!-- Configure the custom Ant tasks for the Manager application --&gt;
    &lt;taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"/&gt;
  
  &lt;!-- Configure the context path for this application --&gt;
    &lt;property name="path"     value="solr"/&gt;
  
    &lt;target name="deploy" description="Install web application"
            &gt;
      &lt;deploy url="${url}" username="${username}" password="${password}"
              path="${path}" war="file:${dist}/solr.war"/&gt;
    &lt;/target&gt;
  </code></pre>
  
  <p>Both a path of /solr and solr don't work.</p>
  
  <pre><code>&lt;tomcat-users&gt;
      &lt;role rolename="manager-gui"/&gt;
      &lt;user password="admin" roles="manager-gui,manager-script,admin" username="admin"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>
  
  <p>EDIT: now it fails to deploy becauase the app already exists at path /solr</p>
  
  <blockquote>
    <p>undeploy:  [undeploy] OK - Undeployed
    application at context path /solr</p>
    
    <p>deploy:    [deploy] FAIL - Application
    already exists at path /solr</p>
    
    <p>BUILD FAILED
    /Users/simpatico/SOLR_HOME/build.xml:532:
    FAIL - Application already exists at
    path /solr</p>
  </blockquote>
  
  <p></p>
  
  <p>
    </p>
  
  <p>
      
    </p>
  
  <p>
      
    </p>