I don't think that changes to ant (i.e., lazy instantiation of all
elements/attributes) are necessary. I would think that just making
the task class(es) not dependent on Xalan, such that a failure to find
Xalan results in a failure to load, should be sufficient.
The JUnit task doesn't have this problem. If JUnit isn't
available, I don't get a class-not-found exception. Instead,
I am notified by my target that checks for JUnit availability.
The formatter and batchtest sub-elements don't cause the same
problem that report does...
<target name="check-junit-avail"
depends="check_availability"
unless="junit-present">
<fail message="The JUnit testing framework is required for testing.
Ensure that JUnit is available on the CLASSPATH.
Visit http://www.junit.org"/>
</target>
<target name="check_availability">
<available classname="junit.framework.TestCase"
classpath="${CLASSPATH}"
property="junit-present"/>
</target>
I would think that lazy (or at least lazier) reference of Xalan
should be possible and that could fix the problem. It would be
nice if any redesign of the junitreport task fixed this little
annoyance along the way.
thanks for listening,
ajk
Stephane Bailliez wrote:
>
> > -----Original Message-----
> > From: Aaron Kamienski [mailto:[EMAIL PROTECTED]]
>
> > I had asked about this previously on the list but got no reply.
> > It seems (to me) to be a problem with the design, so if that's being
> > reworked, there might be hope...
>
> Ah sorry, I did not see your mail.
>
> > I would like to be able to only do the report if Xalan is available.
> > I currently can do this as long as I don't include a <report>
> > sub-element like so:
>
> [...]
>
> I understand your problem.
>
> Actually, this is because the build file resolution is done at startup, thus
> if some instantiated classes related to attributes or elements import
> classes that do not exist it will fail. Even if you do not call the task.
> One solution is to do a lazy instantiation in all elements/attributes, but
> it is not that simple in all cases. In your case, if you do not add the
> <report> element it will work fine just due to this behavior.
>
> --
> Stephane Bailliez
> Software Engineer, Paris - France
> iMediation - http://www.imediation.com
> Disclaimer: All the opinions expressed above are mine and not those from my
> company.
--
Aaron Kamienski <[EMAIL PROTECTED]>
SNAP2 Corporation