title: Ant / Eclipse complains about artifact:dependencies
body: <p>I need to use XML to JSON lib in my war.
  I followed a <a href="http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java/" rel="nofollow">tutorial</a> explaining that dependencies are required in the project.</p>
  
  <p>But when I add the following in my ant <code>build.xml</code> (the file used to create the war), Eclipse complains about the <code>artifact:dependencies</code>, seems like it does not like the <code>:</code>.I have the following error message:</p>
  
  <blockquote>
    <p>The prefix <code>artifact</code> for element <code>artifact:dependencies</code> is not bound...</p>
  </blockquote>
  
  <pre><code>&lt;artifact:dependencies filesetId="dependency.fileset"
      sourcesFilesetId="sources.dependency.fileset"
      javadocFilesetId="javadoc.dependency.fileset"
      versionsId="dependency.versions"&gt;
      &lt;!-- DEPENCIES GO HERE --&gt;
  &lt;/artifact:dependencies&gt;
  </code></pre>
  
  <p>Any idea ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have the same problem trying to define an in-memory pom with:</p>
  
  <pre><code>&lt;artifact:pom id="mypom" groupId="org.acme" artifactId="project1" version="1.0"&gt;
     &lt;dependency groupId="junit" artifactId="junit" version="4.1"/&gt;
     &lt;dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/&gt;
     &lt;license name="apache" url="http://www.apache.org"/&gt;
  &lt;/artifact:pom&gt;
  </code></pre>
  
  <blockquote>
    <p>The prefix <code>artifact</code> for element <code>artifact:pom</code> is not bound...</p>
  </blockquote>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I installed maven-ant jar in ant/lib and change the build.xml so it contains the definition of the artifact stuff but I have an error message while running it.  </p>
  
  <pre><code>&lt;project name="test" default="install" xmlns:artifact="antlib:org.apache.maven.artifact.ant"&gt;
  
  &lt;artifact:dependencies pathId="dependency.classpath"&gt;
     &lt;dependency&gt;
          &lt;groupId&gt;net.sf.json-lib&lt;/groupId&gt;
          &lt;artifactId&gt;json-lib&lt;/artifactId&gt;
          &lt;version&gt;2.3&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;classifier&gt;jdk15&lt;/classifier&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
         &lt;/dependency&gt;
         ...
  </code></pre>
  
  <p>The error message Eclipse gave is:  </p>
  
  <pre><code>BUILD FAILED
  D:\J2EE\workspace\Test\build.xml:3: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:dependencies
  Cause: The name is undefined.
  Action: Check the spelling.
  Action: Check that any custom tasks/types have been declared.
  Action: Check that any &lt;presetdef&gt;/&lt;macrodef&gt; declarations have taken place.
  No types or tasks have been defined in this namespace yet
  This appears to be an antlib declaration. 
      Action: Check that the implementing library exists in one of:
      -D:\eclipse\plugins\org.apache.ant_1.8.2.v20110505-1300\lib
      -C:\Documents and Settings\luc\.ant\lib
      -a directory added on the command line with the -lib argument
  </code></pre>
  
  <p>The maven-ant jar does exist in <code>-D:\eclipse\plugins\org.apache.ant_1.8.2.v20110505-1300\lib</code></p>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>This is the build.xml file I'm using.  </p>
  
  <pre><code>&lt;!--
  &lt;project name="Monitoring" default="install" xmlns:artifact="urn:maven-artifact-ant" xmlns:test="urn:test-tasks"&gt;
  --&gt;
  &lt;project name="Monitoring" default="install" xmlns:artifact="antlib:org.apache.maven.artifact.ant"&gt;
  
  &lt;!-- project-specific variables --&gt;
  &lt;property environment="env" /&gt;
  &lt;property name="project_home" value="D:\J2EE\workspace\Monitoring"/&gt;
  &lt;property name="webapp.dir" value="${project_home}/target" /&gt;
  &lt;property name="jboss.dir" value="D:\J2EE\jboss\standalone\deployments" /&gt;  
  &lt;property name="package.name" value="monitoring.war" /&gt;
  &lt;property name="lib.dir" value="${project_home}/lib" /&gt;
  &lt;property name="src.dir" value="${project_home}/src" /&gt;
  &lt;property name="resources.dir" value="${project_home}/resources" /&gt;
  &lt;property name="dest.dir" value="${project_home}/target" /&gt;
  &lt;property name="package.file" value="${dest.dir}/${package.name}" /&gt;
  
  &lt;!-- put everything in a temp folder with the right structure during the build --&gt;
  &lt;property name="temp.dir" value="${project_home}/temp" /&gt;
  &lt;property name="temp.dir.web-inf" value="${temp.dir}/WEB-INF" /&gt;
  &lt;property name="temp.dir.lib" value="${temp.dir.web-inf}/lib" /&gt;
  &lt;property name="temp.dir.classes" value="${temp.dir.web-inf}/classes" /&gt;
  &lt;property name="temp.dir.meta-inf" value="${temp.dir}/META-INF" /&gt;
  
  
  &lt;path id="build.class.path"&gt;
      &lt;fileset dir="${env.JAVA_HOME}/lib"&gt;
          &lt;include name="**/*.jar" /&gt;
      &lt;/fileset&gt;
      &lt;fileset dir="D:\ant\lib"&gt;
              &lt;include name="**/*.jar" /&gt;
      &lt;/fileset&gt;
  &lt;/path&gt;
  
  &lt;target name="deps"&gt;
      &lt;artifact:dependencies pathId="dependency.classpath"&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.json-lib&lt;/groupId&gt;
              &lt;artifactId&gt;json-lib&lt;/artifactId&gt;
              &lt;version&gt;2.3&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;classifier&gt;jdk15&lt;/classifier&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;xom&lt;/groupId&gt;
              &lt;artifactId&gt;xom&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/artifact:dependencies&gt;
  &lt;/target&gt;
  
  &lt;target name="clean" depends="deps"&gt;
      &lt;delete&gt;
          &lt;fileset dir="${dest.dir}" includes="**/*"/&gt;
      &lt;/delete&gt;
      &lt;delete dir="${temp.dir}" /&gt;
      &lt;delete dir="${temp.dir.classes}" /&gt;
      &lt;delete dir="${temp.dir.meta-inf}" /&gt;
      &lt;delete dir="${temp.dir.web-inf}" /&gt;
  &lt;/target&gt;
  
  &lt;target name="prepare" depends="clean"&gt;
      &lt;mkdir dir="${dest.dir}" /&gt;
      &lt;mkdir dir="${temp.dir}" /&gt;
      &lt;mkdir dir="${temp.dir.lib}" /&gt;
      &lt;mkdir dir="${temp.dir.meta-inf}" /&gt;
      &lt;mkdir dir="${temp.dir.web-inf}" /&gt;
      &lt;mkdir dir="${temp.dir.classes}" /&gt;
  &lt;/target&gt;
  
  &lt;!-- COMPILE --&gt;
  &lt;target name="compile" depends="prepare"&gt;
      &lt;echo&gt;=== COMPILE ===&lt;/echo&gt;
      &lt;echo&gt;Compiling ${src.dir} files ...&lt;/echo&gt;
      &lt;javac debug="on" srcdir="${src.dir}" destdir="${temp.dir.classes}" includes="**/*" includeantruntime="false"&gt;
          &lt;classpath refid="build.class.path" /&gt;
          &lt;classpath refid="dependency.classpath" /&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;!-- PACKAGE --&gt;
  &lt;target name="package" depends="compile"&gt;
    &lt;echo&gt;=== PACKAGE ===&lt;/echo&gt;
  
    &lt;!-- copy the config files --&gt;
    &lt;copy file="${resources.dir}/web.xml" tofile="${temp.dir.web-inf}/web.xml" overwrite="true" /&gt;
    &lt;copy file="${resources.dir}/manifest.mf" tofile="${temp.dir.meta-inf}/manifest.mf" overwrite="true" /&gt;
    &lt;copy todir="${temp.dir.classes}"&gt;
      &lt;fileset dir="${src.dir}"&gt;
        &lt;include name="**/*.xml"/&gt;
        &lt;include name="**/*.xsl"/&gt;
      &lt;/fileset&gt;
    &lt;/copy&gt;
  
    &lt;!-- the ant war task. with all resources in place, create the war file --&gt;
    &lt;war destfile="${package.file}" webxml="${temp.dir.web-inf}/web.xml" basedir="${temp.dir}"&gt;
      &lt;lib dir="${lib.dir}" /&gt;
      &lt;classes dir="${temp.dir.classes}" /&gt;
    &lt;/war&gt;
  &lt;/target&gt;
  
  &lt;!-- INSTALL --&gt;
  &lt;target name="install" depends="package"&gt;
    &lt;echo&gt;=== INSTALL ===&lt;/echo&gt;
    &lt;copy file="${package.file}" tofile="${webapp.dir}/${package.name}" overwrite="true" /&gt;
    &lt;copy file="${package.file}" tofile="${jboss.dir}/${package.name}" overwrite="true" /&gt;        
  &lt;/target&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>It was working well before I added all the dependencies stuff... still cannot find out the pb here. Any help would be very welcome.</p>