You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Russell Gold <ru...@oracle.com> on 2012/04/12 04:10:13 UTC

antrun cannot run junit task

I am converting a convoluted ant build to maven. It has a large number of functional tests, mostly built on either TestNG or the now-deceased author's private framework, but some on junit. I am running the tests via the antrun plugin, but it when it hits a junit task, it fails with:

Could not load class (org.apache.tools.ant.taskdefs.optional.junit.JunitTask) for type junit

I have confirmed that the ant-junit jar is in the classpath (although I'd have expected all ant task jars to be there automatically). What do I need to do to get this to work? And no, I cannot simply move these tests to let maven run them normally - the test build is a horrible mess.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: antrun cannot run junit task

Posted by Wayne Fay <wa...@gmail.com>.
> Aha! Thank you! I searched the antrun plugin docs for info, but it's not
> there. What would it take for this to be added as a FAQ? It seems
> other people have been running into the same problem.

I hate to say RTFM but it is appropriate in this case...
http://maven.apache.org/plugins/maven-antrun-plugin/examples/customTasks.html

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: antrun cannot run junit task

Posted by Russell Gold <ru...@oracle.com>.
Aha! Thank you! I searched the antrun plugin docs for info, but it's not there. What would it take for this to be added as a FAQ? It seems other people have been running into the same problem.

On Apr 11, 2012, at 10:37 PM, Wayne Fay wrote:

>> Could not load class (org.apache.tools.ant.taskdefs.optional.junit.
>> JunitTask) for type junit
>> 
>> I have confirmed that the ant-junit jar is in the classpath (although
>> I'd have expected all ant task jars to be there automatically). What
>> do I need to do to get this to work? And no, I cannot simply move
> 
> Being on the classpath is not necessarily sufficient. Did you simply
> declare this as a dependency (scope=test) in the project? Or did you
> add it to the PLUGIN classpath via <plugin><dependencies><dependency>
> which is what is required for this to work?
> 
> More here:
> http://maven.40175.n5.nabble.com/running-optional-ant-tasks-with-maven-antrun-plugin-td105083.html
> 
> Wayne
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: antrun cannot run junit task

Posted by Wayne Fay <wa...@gmail.com>.
> Could not load class (org.apache.tools.ant.taskdefs.optional.junit.
> JunitTask) for type junit
>
> I have confirmed that the ant-junit jar is in the classpath (although
> I'd have expected all ant task jars to be there automatically). What
> do I need to do to get this to work? And no, I cannot simply move

Being on the classpath is not necessarily sufficient. Did you simply
declare this as a dependency (scope=test) in the project? Or did you
add it to the PLUGIN classpath via <plugin><dependencies><dependency>
which is what is required for this to work?

More here:
http://maven.40175.n5.nabble.com/running-optional-ant-tasks-with-maven-antrun-plugin-td105083.html

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org