You've bound the configuration of the antrun plugin to an execution, which is bound to the test lifecycle phase. This is a good thing.

However, you won't be able to use the configuration within an execution from a direct, command-line invocation like `mvn antrun:run`.

Instead, try running `mvn test` against your current setup. This should compile your sources, compile your test sources (if you have any), and then run your ant script.

Note that if you want to enable execution of your ant script from `mvn antrun:run` while still retaining the ability to do so from `mvn test`, you can simply move the <configuration/> section outside of the <executions/> section, where it will apply generally to all invocations of the antrun plugin.

HTH,

John

Eric Biesterfeld wrote:
So, I have my maven classpath all set up, everything's running quite nicely.
(and once this release is out and I'm settled down in a few projects I'll
try to write up what we did to get our multi-product, multimodule ant
project building under Maven 2...) However, I'm trying to run TestNG and I'm
running into a bit of a problem.

While the ant task I've set up for the task runs quite nicely when run
within the build process, I can't find a way to run this task separately.
From the pom.xml:

    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>run-testng</id>
            <phase>test</phase>
            <configuration>
              <tasks>
                <ant antfile="run-testng.xml" inheritAll="true"
inheritRefs="true"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

and that testng.xml:

<project name="TestNG tests" default="test">

  <path id="local.class.path">
    <pathelement location="./target/test-classes"/>
    <pathelement location="./target/classes"/>
    <path refid="maven.test.classpath"/>
  </path>

  <target name="test">
    <delete dir="target/testdbs"/>
    <taskdef resource="testngtasks" classpathref="local.class.path"/>
    <testng classpathref="local.class.path"
        outputDir="./target/testng-output"
        sourcedir="./src/test/java"
        haltOnfailure="true">
      <xmlfileset dir="./target/test-classes" includes="testng.xml"/>
    </testng>
  </target>
</project>
_______

mvn antrun:run doesn't work. I don't seem to find any property to specify
how to run this particular task after looking at the sources at
http://svn.apache.org/viewcvs.cgi/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/.

Of course, finding a way to pull the dependencies from the POM in the ant
script would work as well. However as it is, there is no obvious way to that
either. As such, I have to modify a build file when I want to run another
set of tests, which is a suboptimal solution.

Thanks for any help! --Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to