Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 134416 - [launching] "Run As.." - "Ant Build" results in "Unable to find ant file to run"
Summary: [launching] "Run As.." - "Ant Build" results in "Unable to find ant file to run"
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-02 12:03 EDT by Jörg von Frantzius CLA
Modified: 2019-11-14 03:31 EST (History)
6 users (show)

See Also:


Attachments
getting ant build bug (82.26 KB, patch)
2011-08-03 10:28 EDT, ella CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg von Frantzius CLA 2006-04-02 12:03:27 EDT
[Eclipse 3.2 M6]

This is Bug#128552, but I can't find a way of reopening it.

When I select an target in the Ant Outline View and chose "Run As.." - "Ant Build", all I get is a dialog saying "Unable to find ant file to run". The file includes other ant files, and the problem happens both with targets defined in the file itself and targets defined in one of the included files.

There are no related errors in the Error Log.
Comment 1 Darin Swanson CLA 2006-04-02 13:18:30 EDT
So I still need to find out what is different about your setup or the Ant buildfile as I cannot reproduce the problem.

This is for all Ant buildfiles in all projects or locations or just one particular buildfile?
Comment 2 Jörg von Frantzius CLA 2006-04-03 09:18:41 EDT
It does work for some build files, e.g. Eclipse-generated ones. Please see bug#134497 for an example build.xml where no target can be invoked from the Ant Outline View.
Comment 3 Darin Swanson CLA 2006-04-03 11:26:28 EDT
Worksforme on 3.2M6:

Selected the default target
From the Ant view> Run As>Ant Build
Build output:

Buildfile: C:\Darins\workspaces\0218\Ant Testing\134497.xml
  [taskdef] Could not load definitions from resource clovertasks. It could not be found.
default:
     [echo] ===================================================================
     [echo] Welcome to JPOX build.
     [echo] ===================================================================
  [taskdef] Could not load definitions from resource clovertasks. It could not be found.

BUILD FAILED
C:\Darins\workspaces\0218\Ant Testing\134497.xml:101: The following error occurred while executing this line:
Target `${build.setting.default.target}' does not exist in this project. 

Total time: 1 second
Comment 4 Jörg von Frantzius CLA 2006-04-03 13:13:53 EDT
When I use a fresh workspace with only that project imported, it works for me as well. 
Comment 5 Etienne Lacombe CLA 2006-04-05 12:28:37 EDT
I get this same error. For me, it is only some Ant files that won't run - two out of 5 right now. These are all manually written ant files dating of before I started using Eclipse. All works through command line.

On one project where this happen, I tried creating a new ant file using the eclipse -> export to ant feature. Even that eclipse generated ant file would not run.

None of those ant files include other files.

I tried yesterday using 3.2M6 but this is still an issue.
Comment 6 Etienne Lacombe CLA 2006-04-05 12:30:24 EDT
Additional note: I can run the file through the external tools but not from the Ant View.
Comment 7 Jörg von Frantzius CLA 2006-04-05 12:35:05 EDT
(In reply to comment #6)
> Additional note: I can run the file through the external tools but not from the
> Ant View.

Did you try using a fresh workspace? That made it work again for me.

Comment 8 Etienne Lacombe CLA 2006-04-07 15:05:33 EDT
It works with a fresh workspace... This should be fixed so it does not corrupt! It's a bit anoying to have to resetup your workspace. Otherwise, I can now use the Ant view again. Thanks.

(In reply to comment #7)
> (In reply to comment #6)
> > Additional note: I can run the file through the external tools but not from the
> > Ant View.
> 
> Did you try using a fresh workspace? That made it work again for me.
> 

Comment 9 Darin Swanson CLA 2006-04-07 15:25:27 EDT
I would love to fix this problem but I have not been able to reproduce and I do not have a technical reason for the failure to investigate.
Comment 10 Ben Tatham CLA 2006-05-16 10:56:01 EDT
I have seen this bug as well (in 3.2 RC3).  On all my ant files in multiple projects.  All the same ant files worked fine in 3.1.2.  I have seen even stranger behaviour: if the ant outline (in the Ant View) is collapsed, I can double-click the top of the tree and it runs fine, after a fresh Eclipse startup.  If I open the outline, I can not run any of the tasks, including from the top.  If I collapse the tree again, it is broken, and I can't run the default again.  

Based on this behaviour, perhaps the problem lies in opening the Ant outline?  Just a guess, as I have not worked on Eclipse myself.

(Note, I did not destroy my workspace when upgrading to 3.2RC3 from 3.1.2.  Is there anything stored in the workspace/project configs for Ant)?
Comment 11 Jörg von Frantzius CLA 2006-06-01 10:56:17 EDT
(In reply to comment #9)
> I would love to fix this problem but I have not been able to reproduce and I do
> not have a technical reason for the failure to investigate.

Hi Darin, you didn't say whether you tried with a 3.1 workspace, so unless you successfully did so, maybe a note should be given in response to "[eclipse-dev] Workspace compatibility section of readme"?
Comment 12 Richard Cook CLA 2006-08-02 17:20:29 EDT
https://bugs.eclipse.org/bugs/show_bug.cgi?id=134416


I am experiencing this issue as well. I just installed 3.2. My workspace was created in 3.1.2. I keep getting "Unable to find an ant file to run" message. If I Right click on the ant task and go through Run As External Tools, it will run. I can not find anything relevant in the error log (that is obvious to me). In any case I'm pasting in the last few exceptions I see...If I try to Run As Ant Build (or double click) to get the error message, nothing is freshly added to the error log...



!ENTRY org.eclipse.jface 4 2 2006-08-02 16:05:11.262
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/ui/viewsupport/ListContentProvider
	at org.jboss.ide.eclipse.xdoclet.run.ui.ConfigurationListViewer.<init>(ConfigurationListViewer.java:115)
	at org.jboss.ide.eclipse.xdoclet.run.ui.properties.ConfigurationPropertyPage.createContents(ConfigurationPropertyPage.java:329)
	at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233)
	at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1403)
	at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:1162)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:843)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1156)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:439)
	at org.eclipse.jface.preference.PreferenceDialog$8.selectionChanged(PreferenceDialog.java:661)
	at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:839)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:843)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:837)
	at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1143)
	at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1163)
	at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:236)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:230)
	at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:404)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)

!ENTRY org.eclipse.core.resources 4 2 2006-08-02 16:06:52.794
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
	at org.jboss.ide.eclipse.core.ProjectChangeListener.resourceChanged(ProjectChangeListener.java:46)
	at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:280)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:274)
	at org.eclipse.core.internal.events.NotificationManager.handleEvent(NotificationManager.java:246)
	at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:250)
	at org.eclipse.core.internal.resources.Project.close(Project.java:186)
	at org.eclipse.ui.actions.CloseResourceAction.invokeOperation(CloseResourceAction.java:184)
	at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:134)
	at org.eclipse.ui.actions.WorkspaceAction$2.runInWorkspace(WorkspaceAction.java:429)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

!ENTRY org.eclipse.core.resources 4 2 2006-08-02 16:06:52.794
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
	at org.jboss.ide.eclipse.core.ProjectChangeListener.resourceChanged(ProjectChangeListener.java:46)
	at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:280)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:274)
	at org.eclipse.core.internal.events.NotificationManager.handleEvent(NotificationManager.java:246)
	at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:250)
	at org.eclipse.core.internal.resources.Project.close(Project.java:186)
	at org.eclipse.ui.actions.CloseResourceAction.invokeOperation(CloseResourceAction.java:184)
	at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:134)
	at org.eclipse.ui.actions.WorkspaceAction$2.runInWorkspace(WorkspaceAction.java:429)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)


Some system info...


*** Date: Wed Aug 02 16:27:52 EDT 2006

*** Platform Details:

*** System properties:
awt.toolkit=sun.awt.windows.WToolkit
eclipse.buildId=M20060629-1905
eclipse.commands=-os
win32
-ws
win32
-arch
x86
-launcher
C:\Program Files\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
8a4_50
-vm
C:\WINDOWS\system32\javaw.exe
eclipse.ee.install.verify=false
eclipse.product=org.eclipse.sdk.ide
eclipse.startTime=1154457930979
eclipse.vm=C:\WINDOWS\system32\javaw.exe
eclipse.vmargs=-Xmx256M
-jar
C:\Program Files\eclipse\startup.jar
eof=eof
file.encoding=Cp1252
file.encoding.pkg=sun.io
file.separator=\
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=C:\Program Files\eclipse\startup.jar
java.class.version=49.0
java.endorsed.dirs=C:\Program Files\Java\jre1.5.0_06\lib\endorsed
java.ext.dirs=C:\Program Files\Java\jre1.5.0_06\lib\ext
java.home=C:\Program Files\Java\jre1.5.0_06
java.io.tmpdir=C:\DOCUME~1\rcook\LOCALS~1\Temp\
java.library.path=C:\WINDOWS\system32;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\apache-ant-1.6.5\bin;C:\Program Files\PostgreSQL\8.1\bin
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version=1.5.0_06-b05
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.5
java.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
java.version=1.5.0_06
java.vm.info=mixed mode, sharing
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=1.5.0_06-b05
line.separator=
Comment 13 Joril CLA 2006-08-16 08:20:44 EDT
(In reply to comment #10)
> if the ant outline (in the Ant View) is collapsed, I can
> double-click the top of the tree and it runs fine, after a fresh Eclipse
> startup.  If I open the outline, I can not run any of the tasks
>
> (Note, I did not destroy my workspace when upgrading to 3.2RC3 from 3.1.2.
 
Same here.. I tried to remove all ant-related config files from my .metadata (and restart Eclipse) but the behaviour is still there.. If I open the outline, it won't run any of the tasks
Comment 14 Joril CLA 2006-08-16 09:08:13 EDT
(In reply to comment #13)

I noticed that even if the Ant view won't run tasks, the Outline view (while a Ant build file is opened in the editor) DOES work.. (Eclipse 3.2 with a 3.1.2-generated workspace)
Comment 15 cedric wider CLA 2006-08-28 02:54:51 EDT
I experienced the same issue after upgrading from eclipse 3.1.2 to 3.2.0. The workspace was created using eclipse 3.1.2 wher all ant targets used to run fine. After installation of eclipse 3.2.0 I get an error message saying: "Unable to find ant file to run".
All those ant targets work fine on the console.
Comment 16 Joril CLA 2006-09-20 09:34:17 EDT
I tried creating a new workspace with 3.2 and then importing my projects (made with 3.1.x), but the problem is still there :(
Comment 17 Joril CLA 2006-09-20 09:58:48 EDT
I found out that even while using the 3.1.2-generated workspace there's a tweak to get a working Ant view, but my setup is a bit unusual, so YMMV.
For various reasons my workspace contains projects that are not physical directories, but symlinks to directories outside the workspace.. If I try to run an Ant task from such a project it won't work, but if I close the project, remove the symlink, copy the real directory into the workspace, reopen the project and retry running Ant, everything is fine.
I also noticed that while in "symlink mode" I can't drag an Ant script from the Package explorer to the Ant view, the view won't "catch" the file. In "real mode" instead drag and drop works.
Comment 18 Mark Cowley CLA 2006-12-19 10:21:09 EST
I am seeing this with Eclipse 3.2.1.
There is nothing being reported in any of the error logs.
I have 7 projects all very similar to each other and I get this problem with 2 of them - from the ant view if I double click to call the target then the error message pops up
'Build Failed
Unable to find Ant file to run'

Are there any debug options I can use to help with this?
Comment 19 Jean-Marie White CLA 2007-01-13 23:47:56 EST
(In reply to comment #17)
> I found out that even while using the 3.1.2-generated workspace there's a tweak
> to get a working Ant view, but my setup is a bit unusual, so YMMV.
> For various reasons my workspace contains projects that are not physical
> directories, but symlinks to directories outside the workspace.. If I try to
> run an Ant task from such a project it won't work, but if I close the project,
> remove the symlink, copy the real directory into the workspace, reopen the
> project and retry running Ant, everything is fine.
> I also noticed that while in "symlink mode" I can't drag an Ant script from the
> Package explorer to the Ant view, the view won't "catch" the file. In "real
> mode" instead drag and drop works.
> 

I had the same problem.  However, I wasn't symlinking to folders, but my build.xml file was a symlink to an ant file outside of the workspace.  I decided to use a hard link instead (ln without -s) and now everything is working.
Comment 20 Szanto Peter CLA 2007-04-20 10:24:44 EDT
I had this "unable to find an ant file to run" and solved by removing the UPPER case letters from the project directory's name. Intresingly I was able to run the default task even with the upper case directory name until I didnt opened the tree of the ant script.
Comment 21 Mark Cowley CLA 2007-04-20 11:45:32 EDT
Thanks to Szanto Peter - your suggestion has solved my rpoblem.
Comment 22 Joril CLA 2007-04-23 04:48:01 EDT
With my "strange setup" (projects symlinked into workspace) the problem is still there even with lowercase names :/
Comment 23 Stephen Solka CLA 2007-05-04 11:48:22 EDT
>I had this "unable to find an ant file to run" and solved by removing the UPPER
>case letters from the project directory's name. Interestingly I was able to run
>the default task even with the upper case directory name until I didnt opened
>the tree of the ant script.

I was able to fix it by renaming the project and directory. The original name had a capital letter pattern as such xxXXxxxx. What interesting is another project using ant build files worked fine with capital letters like XxxxXx.
Comment 24 Barry Ku CLA 2007-06-11 20:55:24 EDT
In my case, the error occurs after the project is shared as a CM Synergy project.  The same build script works without any issues before sharing, and I can get rid of the error by creating a new project pointing to the same source tree again.  To reproduce the error, simply share the project with CM Snyergy and restart Eclipse. Note that the default target can be run w/o expanding the buid targets, but it will fail with the same error once the targets are expanded.

This in working in 3.1.x and fails on both 3.2.2 and 3.3RC.
Comment 25 ella CLA 2011-08-03 10:28:19 EDT
Created attachment 200817 [details]
getting ant build bug
Comment 26 Lars Vogel CLA 2019-11-14 03:31:22 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.

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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.