title: How to use artifact:writepom and artifact:pom?
body: <p>I've been trying to use writepom using this <a href="http://maven.apache.org/ant-tasks/examples/write-pom.html" rel="nofollow noreferrer">http://maven.apache.org/ant-tasks/examples/write-pom.html</a> as a reference and have been having problems. I'm essentially just trying to test whether it will actually work so the POM file is quite bare. See below. </p>
  
  <pre><code>&lt;project name="CreatePOMStructure" basedir="./test" xmlns:artifact="antlib:org.apache.maven.artifact.ant"&gt;
   &lt;description&gt;
    Test Script
   &lt;/description&gt;
  
   &lt;path id="maven-ant-tasks.classpath" path="/usr/local/apache-ant-1.8.1/lib/maven-ant-tasks-2.1.1.jar" /&gt;
   &lt;typedef resource="org/apache/maven/artifact/ant/antlib.xml"
              uri="antlib:org.apache.maven.artifact.ant"
              classpathref="maven-ant-tasks.classpath" /&gt;
  
   &lt;artifact:pom id="maven-pom" groupId="com.cgi.wealth" artifactId="maven-pom-setup" version="1.0" name="maven-setup"&gt;
    &lt;license name="apache" url="http://www.apache.org"/&gt;
       &lt;dependency groupId="junit" artifactId="junit" version="4.1" scope="test"/&gt;
       &lt;dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/&gt;
   &lt;/artifact:pom&gt;
  
   &lt;artifact:writepom pomRefId="mypom1" file="mypom1.xml"/&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I get this error when I try to run ant </p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal
    org.apache.maven.plugins:maven-antrun-plugin:1.0:run
    (compile) on project maven-setup:
    Error executing ant tasks: The
    following error occurred while
    executing this line:
    /maven-setup/scripts/build.xml:11:
    java.lang.NoSuchMethodError:
    org.apache.maven.settings.RuntimeInfo.(Lorg/apache/maven/settings/Settings;)V
    -> [Help 1]</p>
  </blockquote>
  
  <p>I'm not sure if it's relevant, but before I added the typedef I was getting this error: </p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal
    org.apache.maven.plugins:maven-antrun-plugin:1.0:run
    (compile) on project maven-setup:
    Error executing ant tasks: The
    following error occurred while
    executing this
    line:/maven-setup/scripts/build.xml:9:
    Could not create task or type of type:
    antlib:org.apache.maven.artifact.ant:pom.</p>
    
    <p>Ant could not find the task or a class
    this task relies upon.</p>
  </blockquote>
  
  <p>Sorry for the most likely basic question, but I can't seem to fix this myself.</p>
  
  <p>[EDIT]</p>
  
  <p>Here's the pom.xml file which I use to run the ant build. </p>
  
  <pre><code>    &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.cgi.wealth&lt;/groupId&gt;
    &lt;artifactId&gt;maven-setup&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
  
                  &lt;version&gt;1.0&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;compile&lt;/id&gt;
                          &lt;phase&gt;generate-sources&lt;/phase&gt;
                          &lt;configuration&gt;            
                              &lt;tasks&gt;
                                  &lt;ant antfile="${basedir}/scripts/build.xml" /&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;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
              &lt;artifactId&gt;maven-ant-tasks&lt;/artifactId&gt;
              &lt;version&gt;2.1.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;    
  &lt;/project&gt;
  </code></pre>
  
  <p>The problem with the project only exists when running the maven task "mvn generate-sources" (see pom.xml above). When I just run "ant" it builds successfully. Any insight is greatly appreciated.</p>