title: Using antcontrib <if> task via maven-antrun-plugin
body: <p>My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the <code>&lt;if&gt;</code> task and this seems to be causing the problem;</p>
  <blockquote>
  <p>[INFO] Executing tasks<br />
  [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found.</p>
  <p>deploy:<br />
  [INFO] ------------------------------------------------------------------------<br />
  [ERROR] BUILD ERROR<br />
  [INFO] ------------------------------------------------------------------------<br />
  [INFO] An Ant BuildException has occured: The following error occurred while executing this line:<br />
  E:\My_Workspace\xxxxxx\xxxxxx\xxxxxxx\deploy.xml:24: Problem: failed to create task or type if<br />
  Cause: The name is undefined.<br />
  Action: Check the spelling.<br />
  Action: Check that any custom tasks/types have been declared.<br />
  Action: Check that any &lt;presetdef&gt;/&lt;macrodef&gt; declarations have taken place.</p>
  </blockquote>
  <p>Here is the antrun plugin config from my pom;</p>
  <pre><code>&lt;plugin&gt;
      &lt;inherited&gt;false&lt;/inherited&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;remote-deploy&lt;/id&gt;
              &lt;phase&gt;install&lt;/phase&gt;
              &lt;configuration&gt;
                  &lt;tasks&gt;
                      &lt;taskdef resource=&quot;net/sf/antcontrib/antcontrib.properties&quot; classpathref=&quot;maven.plugin.classpath&quot;/&gt;
  
                          &lt;property name=&quot;compile_classpath&quot; refid=&quot;maven.compile.classpath&quot; /&gt;
                          &lt;property name=&quot;runtime_classpath&quot; refid=&quot;maven.runtime.classpath&quot; /&gt;
                          &lt;property name=&quot;plugin_classpath&quot; refid=&quot;maven.plugin.classpath&quot; /&gt;
                                  
                          &lt;echo message=&quot;compile classpath: ${compile_classpath}&quot;/&gt;
                          &lt;echo message=&quot;runtime classpath: ${runtime_classpath}&quot;/&gt;
                          &lt;echo message=&quot;plugin classpath: ${plugin_classpath}&quot;/&gt;
  
                          &lt;ant antfile=&quot;${basedir}/deploy.xml&quot;&gt;
                              &lt;target name=&quot;deploy&quot; /&gt;
                          &lt;/ant&gt;
                  &lt;/tasks&gt;
              &lt;/configuration&gt;
              &lt;goals&gt;
                  &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ant-contrib&lt;/groupId&gt;
              &lt;artifactId&gt;ant-contrib&lt;/artifactId&gt;
              &lt;version&gt;1.0b3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ant&lt;/groupId&gt;
              &lt;artifactId&gt;ant&lt;/artifactId&gt;
              &lt;version&gt;1.7.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ant&lt;/groupId&gt;
              &lt;artifactId&gt;ant-jsch&lt;/artifactId&gt;
              &lt;version&gt;1.7.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>
  <p>.. and here is the relevant section from my deploy.xml;</p>
  <pre><code>&lt;target name=&quot;deploy&quot; if=&quot;deploy&quot;&gt;
      &lt;if&gt;    &lt;!-- line 24 --&gt;
          &lt;and&gt;
  </code></pre>
  <p>Why I look in my maven repo I can see <code>ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar</code> and when I look inside the jar I can see <code>net/sf/antcontrib/antcontrib.properties</code> so no problem there.</p>
  <p>When I check the values of <code>maven.compile.classpath</code>, <code>maven.compile.classpath</code> and <code>maven.compile.classpath</code> I can't see any reference to <code>antcontrib</code>, could this be the problem? Why don't they appear when <code>antcontrib</code> is defined as a dependancy?</p>