ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Kamienski <aar...@snaptwo.com>
Subject Problem using junitreport/report only if available
Date Wed, 06 Jun 2001 17:59:17 GMT
Hello,

I would like to run junitreport only if Xalan is present.  So, I have
something like the following in my build script:

  <target name="init">
    <!-- Xalan (XSLT Processor) available -->
    <available classname="org.apache.xalan.xslt.XSLTProcessor"
               classpath="${CLASSPATH}"
               property="xalan-present"/>
  </target>

  <target name="junitreport" depends="init" if="xalan-present">
    <junitreport/>
  </target>

This works as expected.  However, I have problems if I add a "report" 
element to the junitreport like so:

  <target name="junitreport" depends="init" if="xalan-present">
    <junitreport>
      <report/>
    </junitreport>
  </target>

And the problem occurs whether I try and run the target or not.
Simply running "ant -buildfile ack2.xml -projecthelp" will give me:

Buildfile: ack2.xml

BUILD FAILED

D:\SNAP2\HAVI\HAVi\ack2.xml:12: java.lang.NoClassDefFoundError:
org/apache/xalan
/xslt/XSLTInputSource
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/apache/xalan/xslt/XSLTInputSource
        at
org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator.createReport(XMLResultAggregator.java:114)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.tools.ant.IntrospectionHelper$1.create(IntrospectionHelper.java:167)
        at
org.apache.tools.ant.IntrospectionHelper.createElement(IntrospectionHelper.java:275)
        at
org.apache.tools.ant.ProjectHelper$NestedElementHandler.init(ProjectHelper.java:535)
        at
org.apache.tools.ant.ProjectHelper$TaskHandler.startElement(ProjectHelper.java:499)
        at
org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1335)
        at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:821)
        at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1852)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1233)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
        at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:211)
        at
org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:117)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:403)
        at org.apache.tools.ant.Main.main(Main.java:149)

Total time: 1 second

This looks like a bug to me (or is it a feechur?).  Is there a 
recommended way around this so that I can accomplish what I want
(running junitreport task only if Xalan is present)?

thanks,

ajk

-- 
Aaron Kamienski <aaronk@snaptwo.com>
SNAP2 Corporation

Mime
View raw message