[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [platform-ant-dev] Heads up: Eclipse Ant Support will be changing
Thanks for the heads up. We were not aware of the problems you're
mentioning. We have considered on forking a JVM to run Ant but it would
make it almost impossible for tasks relying on Eclipse-specific objects to
run (e.g. refreshLocal). Now it seems we should reconsider it and probably
make it optional for the user: run scripts on a separate JVM and lose
Eclipse-specific tasks or run it on the same JVM and lose these tasks you
Peter Donald <peter@xxxxxxxxxx>
Sent by: platform-ant-dev-admin@xxxxxxxxxxx
04/03/02 02:46 PM
Please respond to platform-ant-dev
Subject: Re: [platform-ant-dev] Heads up: Eclipse Ant Support will be changing
Just as a heads up. There is no way you can currently maintain 100%
compatability with the commandline invocation of ant if you don't start a
JVM. Some tasks/classes rely on being loaded from the system ClassLoader.
one stage we tried to change the ant runtime so that it would be easy to
allow embedding in another ClassLoader but unfortunately it broke too much
stuff. So we ended up being forced to go back to our old method for
We are trying to address these issues in ant2 but that wont be out for a
I would recomend that you start a new JVM (possibly with a custom launcher
that registers your particular librarys) to do ant compiles if you want
On Thu, 4 Apr 2002 01:38, Rodrigo_Peretti@xxxxxxx wrote:
> We are planning to make a significant change to the way Ant works inside
> Eclipse. This note explains the problem we want to solve, outlines the
> solution, and explains the impact of these changes on existing clients
> users of Ant in Eclipse.
> The problem is simple enough to explain: running Ant scripts inside
> is different from running Ant scripts outside Eclipse.
> - Some Ant tasks that work fine outside Eclipse do not work inside
> (e.g., the classic javac task)
> - It is difficult to access specialized Ant tasks from inside Eclipse,
> there is no simple way to include extra JARs on classpath when Ant is
> - Inside Eclipse, there is no way to choose a different version of Ant.
> For the 2.0 release, we want to change this so that running Ant inside
> offers the same degrees of flexibility as running it outside. We want to
> that preexisting specialized Ant tasks can be used. And we still want it
> be possible to define and use Eclipse-specific Ant tasks that
> directly with the running Eclipse platform.
> What's the problem? Why not just allow the user to specify extra JARs
> classpath used to look up Ant task classes while running Ant scripts.
> tools.jar so that javac can be found. And give the user a preference for
> setting the entry for ant.jar so that it's now easy to point to a
> version of Ant. That should do the trick.
> Although this is indeed the basic outline of the solution we're
> there are some obstacles to making this happen. These obstacles are
> In order to run Ant, we need to poof up a suitable classloader and give
> it a classpath to search when loading code. This classpath would include
> tools.jar and a user-specified list of JARs containing code for
> Ant tasks. Eclipse-specific Ant tasks reference classes in Eclipse
> this means that the Ant classloader will have appeal to the Eclipse
> platform plug-in classloaders in order to find these classes. What about
> ant.jar itself? (Here's where things get ugly.)
> If we put ant.jar as a library inside a plug-in (in 1.0, ant.jar is
> a library for the org.eclipse.ant.core plug-in), then a plug-in
> the honor of loading the Ant code. When Ant itself uses Class.forName to
> a class mentioned in a task definition, the plug-in classloader will not
> looking in the user-specified JARs and, consequently, will be unable to
> find any
> tasks other than the built-in ones. (This explains the limitations we
> Eclipse 1.0.)
> If, on the other hand, we put ant.jar as a JAR entry on the classpath,
> will be loaded directly by our Ant classloader. Ant Class.forName
> be able to find classes in any of the user-specified JARs, and in any
> that it is collaborating with. In this arrangement, however, none of the
> classes are visible to the Eclipse plug-in classloaders, making it
> to run an Eclipse-specific Ant task loaded by a plug-in classloader!
> Fortunately, there is no such problem with Eclipse-specific Ant tasks
> in JARs (i.e., like other Ant tasks) loaded directly by the Ant
> Because of these properties of Java classloaders, the only way to gain
> flexibility of being able to include additional JARs on the classpath is
> move to the latter scheme: ant.jar as a JAR entry on the classpath along
> with JARs containing additional Ant tasks.
> These changes will impact clients that define their own Eclipse-specific
> tasks, Ant types, Ant objects. (It does not impact regular users of
> The main change is that library plug-in JARs cannot contain Ant tasks.
> Ant tasks need to be put in separate JARs that will be included on the
> Ant classpath so that it can be loaded directly by the Ant classloader.
> We suggest developing Ant tasks in a project separate from projects used
> to develop the code for plug-ins. In order to compile code against the
> org.apache.ant API, this project will need to include an ant.jar as a
> library on its build classpath. (Note also that the
> org.eclipse.ant.core plug-in will no longer provide ant.jar as a
> plug-in library.)
> Eclipse-specific Ant tasks (etc.) can still be made known to Eclipse via
> extension point. The XML markup includes an additional library attribute
> specifies the JAR in which to find the code for task (the path is
> the base of the plug-in). Example:
> Old XML element for contributing an Ant task:
> <extension point="org.eclipse.ant.core.antTasks">
> <antTask name="myTask" class="com.examples.MyTask"/>
> New XML element:
> <extension point="org.eclipse.ant.core.antTasks">
> <antTask name="myTask" class="com.examples.MyTask"
> The contributions to these extension points are used to automatically
> these library JARs on the Ant classpath, and to fabricate appropriate
> taskdefs. And any plug-in that contributes to these extension points is
> automatically included on the classpath as a collaborating class loader.
> Using this mechanism is not mandatory. The alternative, and
> way is to include a JAR containing one or more Ant tasks on the
> write explicit Ant taskdefs in the Ant script file. This is useful when
> already have a JAR of specialized Ant tasks that you just want to
> on the Ant classpath.
> These following changes to the Ant UI expose the changes to Ant core:
> + When running Eclipse with a JDK (as opposed to a JRE), tools.jar will
> automatically included on the Ant classpath.
> + New UI to allow users to specify extra JARs to include on the Ant
> + New UI to allow users to specify new Ant tasks and types that will be
> available when running Ant scripts (so that you don't need to write
> + New UI to allow users to locate the ant.jar for the version of Ant
> to run their Ant scripts. The default will be the version of ant.jar
> ships with Eclipse in the org.apache.ant plug-in.
> Please send any comments and questions to the
> developer mailing list.
> platform-ant-dev mailing list
Frank Zappa observed: "It's not getting any smarter out
there.You have to come to terms with
stupidity, and make it work for you."
platform-ant-dev mailing list