ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rees <>
Subject Re: Lesson learned in building optional.jar
Date Wed, 07 Mar 2001 08:13:06 GMT
On Tue, 6 Mar 2001 11:16:18 -0800, Skip Hovsmith wrote:

>Just thought I'd pass on a lesson learned in building optional.jar.
>I wrap most java apps with a script which sets the appropriate classpath. My
>default classpath is empty.
>With ant 1.3, I built the source using 'ant install'. The ant script
>included the jars it needed, but couldn't include the optional dependencies
>such as junit.jar. The build install ran and completed successfully.
>Next I fire up ant with a known build.xml file which dutifully sets
>junit.jar when running the junit task. The junit task fails saying it can't
>find the test runner. When I look for the test runner in optional.jar, it's
>not there! After wondering (perhaps a mild understatement) how the ant
>developers could leave the junit tasks out of optional.jar, I finally catch
>on that the classes weren't added to the optional.jar because I didn't have
>junit.jar on my classpath for the original build install. Obvious now, but
>it sure tripped me up for a while...
>The original build install probably output that it failed to build some of
>the junit related classes, but I just saw the build completed okay message
>at the end and mindlessly moved on.

Nope, it doesn't give any warnings because Junit is "optional" ;).

>So, if your optional.jar is missing some tasks, make sure you've added all
>the optional dependency jars to your classpath before building ant or just
>grab the optional.jar off the ant distribution.

The problem is that you ran ant directly instead of using build.bat or They automatically add the optional jars to the class path
if it exists. Not sure why this doesn't happen in build.xml instead,
especially for junit.jar since its in the build.


View raw message