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

Reply via email to