ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject [Ant 1.6beta2] Problem with <junit> task and ant-launcher.jar
Date Sun, 19 Oct 2003 21:45:44 GMT
Hi all,

I'm trying to run the Cactus build with Ant 1.6beta2 and have 
encountered a problem: we're using JUnit test cases that setup Ant 
projects from build files to test custom Ant tasks, similar to what is 
done by the Ant build itself.

The base test case class is here:
http://cvs.apache.org/viewcvs.cgi/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/AntTestCase.java?rev=1.10&content-type=text/vnd.viewcvs-markup

It includes the following setUp() method:

   protected void setUp() throws Exception
   {
     this.project = new Project();
     this.project.addBuildListener(this);
     this.project.init();
     File buildFile = getBuildFile(this.buildFile);
     this.project.setUserProperty("ant.file",
                                  buildFile.getAbsolutePath());
     ProjectHelper helper = ProjectHelper.getProjectHelper();
     helper.parse(this.project, buildFile);
     if (getProject().getTargets().get("setUp") != null)
     {
       getProject().executeTarget("setUp");
     }
   }

I'm getting an exception thrown from ProjectHelper#parse():

     [junit] Testcase: 
testGenericContainerWithTasks(org.apache.cactus.integration.ant.TestContainerSet): 
        Caused an ERROR
     [junit] org/apache/tools/ant/launch/Locator
     [junit] java.lang.NoClassDefFoundError: 
org/apache/tools/ant/launch/Locator
     [junit]     at 
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
     [junit]     at 
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown 
Source)
     [junit]     at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)
     [junit]     at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown

Source)
     [junit]     at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
     [junit]     at 
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     [junit]     at 
org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
     [junit]     at org.apache.xerces.parsers.XMLParser.parse(Unknown 
Source)
     [junit]     at 
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
     [junit]     at 
org.apache.cactus.integration.ant.AntTestCase.setUp(AntTestCase.java:200)
     [junit]     at 
org.apache.cactus.integration.ant.TestContainerSet.setUp(TestContainerSet.java:88)

The corresponding <junit> invocation does not specifiy the 
"includeantruntime" attribute, which defaults to true. So the Ant 
runtime should be included in the classpath. However, the 
ant-launcher.jar doesn't seem to be on the classpath here. If I 
specifically include ant-launcher.jar in the test classpath, the tests 
run successfully again.

Anyway, running the Cactus build unmodified doesn't work with Ant 
1.6beta2, but works nicely with Ant 1.5.x, so I think this should be 
considered a regression.

Any ideas?
-chris

-- 
Christopher Lenz
/=/ cmlenz at gmx.de



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message