Community
Participate
Working Groups
Using 2.1-M3, if I setup my ExternalTools/Ant configuration to NOT include optional.jar, it still gets included. To duplicate, remove optional.jar in Preferences, and run the following build file. It runs successfully even though <propertyfile/> is in optional.jar. This causes grief to anyone trying to declaratively setup ant classloaders in their build files rather than just putting all jars in ANT_HOME/lib - optional.jar typically needs to be in the same classloader as all the jars it depends on e.g. bsf.jar and the script task <project name="bar" default="all"> <target name="all"> <echo message="Howdy"/> <propertyfile file="foo.properties"> <entry key="foo" value="bar"/> </propertyfile> <echo message="Doody"/> </target> </project> Also, using a brand new eclipse 2.1M3 install with a new workspace, if I remove optional.jar from Ant classpath, click ok, subsequently returning to the preferences dialog shows it is gone, but when I restart eclipse, it reappears (i.e. not being saved) - this may be related to bug 26061
The optional.jar URL is not being explicitly added to the Ant classloader. We should take a look at what we are getting for free from some of the associated plugin class loaders. I could not reproduce the preferences problem.
The preferences problem seems to have been fixed between M3 and todays build. The optional.jar problem still stands.
Need to investigate now that core resources is no longer directly pre-req'ing org.apache.ant.
So I have found the root of the problem for this issue...it is the classpath entry in the manifest file of the ant.jar provided from apache. Our AntClassLoader is a subclass of URLClassLoader. If a jar on the classpath for the classloader has the classpath entry in the manifest, the jars listed in the manifest are added to the classpath as well. Matt, when you are doing this from the commandline, do you remove the optional.jar from the ANT_HOME/lib directory?
Yes, luckily I renamed optional.jar to ant-optional.jar in ANT_HOME/lib - which is probably why I don't have this problem on the command line.
Going to have to mark this as won't fix. (README). Removing the entries from the JAR manifest files can break forked tasks (such as junit). The workaround is to set an ANT_HOME that: does not include the optional.jar or has been renamed the jars in the lib directory have all had the manifest file changed.
From the ant-dev mailing list: > I vaguely remember discussions about pulling those entries out of > ant.jar's manifest, and having an empty JAR with them defined!?!? Is > that in 1.6? Yes. ant.jar in 1.6 has Manifest-Version: 1.0 Main-Class: org.apache.tools.ant.Main and nothing else. There is an ant-bootstrap.jar that contains Main.class and a manifest with Class-Path: ant.jar xml-apis.jar xercesImpl.jar optional.jar xalan.jar