Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326357 - Not able to use Eclipse ant tasks even though I'm using the antRunner.
Summary: Not able to use Eclipse ant tasks even though I'm using the antRunner.
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-27 17:45 EDT by Thomas Hallgren CLA
Modified: 2021-12-26 14:05 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2010-09-27 17:45:03 EDT
I have an ant build file with some eclipse defined ant tasks such as "eclipse.convertPath". I can run this script without problems from my IDE but I'm not able to run it from the command line using the eclipse antRunner. My command, executed on a freshly installed classic 3.6.1 IDE, looks like this:

$ECLIPSE_HOME/eclipse -consolelog -nosplash -data $WORKSPACE -application org.eclipse.ant.core.antRunner -buildfile <path to build file>

Ant complains that the eclipse.convertPath is undefined. I know that this task is registered by the o.e.core.resources bundle and I checked (using -console -noexit and then 'ss') that this bundle is started. It's status shows as ACTIVE so I'm a bit lost here. What am I doing wrong?

Here's a full stack trace from the invocation:

<path to build file>:2: Problem: failed to create task or type eclipse.convertPath
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

	at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:484)
	at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:416)
	at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160)
	at org.apache.tools.ant.Task.perform(Task.java:347)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseBuildFile(InternalAntRunner.java:347)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.getTargetNames(InternalAntRunner.java:448)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.processUnrecognizedTargets(InternalAntRunner.java:1129)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.processCommandLine(InternalAntRunner.java:1112)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:597)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:534)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.ant.core.AntRunner.run(AntRunner.java:513)
	at org.eclipse.ant.core.AntRunner.start(AntRunner.java:600)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Thomas Hallgren CLA 2010-09-28 01:28:44 EDT
An update.

I found that I only run into problems if I use 'eclipse.convertPath' as a root element. If I move it into a target that I have my other targets depend on, then it works. Not sure why that is or why it works when running from the IDE but not from the command line.
Comment 2 Ted Habeck CLA 2010-11-17 20:00:33 EST
(In reply to comment #1)
> An update.
> 
> I found that I only run into problems if I use 'eclipse.convertPath' as a root
> element. If I move it into a target that I have my other targets depend on,
> then it works. Not sure why that is or why it works when running from the IDE
> but not from the command line.

I ran into a similar problem, and built a test program under Eclipse Indigo.  The Eclipse class loader when executed from antRunner on the command line under the Indigo 3.7M3 build is (org.eclipse.equinox.launcher_1.2.0.v20100824b.jar):


antTask classloader:   org.eclipse.ant.internal.core.AntClassLoader
parent classloader:      sun.misc.Launcher.AppClassLoader

If I run the same antTask under eclipse Galileo's antRunner the following class loaders are in use (org.eclipse.equinox.launcher_1.0.200.v20090520.jar):

antTask classloader:  org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader
parent classloader:    org.eclipse.osgi.baseadapter.BaseAdaptor.ParentClassLoader.

According to the eclipse documentation, the plug-in class loader is *supposed* to be added as the parent class loader when an ant task contributed by a plug-in has headless=true, and eclipseRuntime=true set in the org.eclipse.ant.core.antTasks extension point.   From the test results, it would appear that this is not the case.   

I can supply the test program if that helps.  It is very reproducible.
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:17:37 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 4 Eclipse Genie CLA 2021-12-26 14:05:25 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.