Paul Galbraith wrote:
> 
> 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]
> 
> 
> 

Good day to you, Paul,

You may want to try using maven-surefire-plugin (see [1] for more info).
Basically, you'd just have to put your unit tests under src/test/java and
its resources in src/test/resources and your unit tests would automatically
be executed with some of the lifecycle such as package and install.

Btw, [1] has not yet been released. If you have any comments about the
documentation, kindly feel free to tell us about it so that we can make the
neccessary changes.

Thanks,
Franz

[1] http://people.apache.org/~aramirez/maven-surefire-plugin/
-- 
View this message in context: 
http://www.nabble.com/antrun-plugin%2C-junit-classpath-tf2289408.html#a6366709
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to