I want to use M2's antrun plugin to execute a junit task, but I keep getting errors indicating that ant can't find junit in the classpath.

My POM has:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>junit</id>
      <phase>test</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <tasks>
          <junit>
            ...
          </junit>
        </tasks>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</plugin>

I get the following output:

========================================================================

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-antrun-plugin:1.1:run'
-->
[DEBUG] (f) artifacts = [junit:junit:jar:3.8.1:test, ant:ant:jar:1.6.5:runtime , ant:ant-launcher:jar:1.6.5:runtime, org.apache.maven:maven-project:jar:2.0.1:r
untime, org.apache.maven:maven-plugin-api:jar:2.0.1:runtime]
[DEBUG]   (f) project = [EMAIL PROTECTED]
[DEBUG]   (f) tasks =
[DEBUG] -- end configuration --
[INFO] [antrun:run {execution: junit}]
[INFO] Executing tasks
[DEBUG] getProperty(ns=null, name=ant.reuse.loader, user=false)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: Could not create task or type of type: junit.

Ant could not find the task or a class this task relies upon.

========================================================================

If I remember correctly, this is typical when running ant standalone, if junit is not on ant's classpath.

Is there any way to get this to work in M2?

Paul


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

Reply via email to