Community
Participate
Working Groups
Currently the Ant plugin is bundled with a minimal binary distribution of Ant (encompassing the ant.jar and optional.jar). This poses a problem when Ant is used outside of Eclipse to build projects developed inside Eclipse as a different version of Ant might be used. Further the command line frontend of Ant also conciders other files inside its installation directory (ANT_HOME) besides lib/ant.jar and lib/optional.jar. The online documentation mentions how to set up the plugin to use a different version of Ant by modifying the classpath entries on the preference page for the plugin. Another solution would be to let the user specify the installation of Ant to use by entering the local installation directory of ant (ANT_HOME). This would also allow the plugin to set the ant.home property to a meaningful value. (The ant.home property is used internally by the core task <exec>.) Further the jar files inside ANT_HOME/lib could be added to the classpath the plugin uses when launching Ant.
From the newsgroup: > But the Ant plugins, however, can't provide a reasonable value for ant.home > since it wouldn't make sense for the packaged Ant distribution which only > comprises ant.jar and optional.jar. > > As a (minimalistic) solution the Ant plugins could support setting arbitrary > global properties in the preference page. These properties would then be > set for all builds without having to be entered in the arguments field of > the Ant runner. Here I could declare ant.home to point to my installation > directory of Ant. > > -- > knut
Global properties and global property files can be set via the preference pages (see bug 25698 and bug 25699). As well on the classpath page the user can explicitly set ANT_HOME. This updates the Ant runtime libraries based on the jars found in the lib directory below the specified ANT_HOME. By default ANT_HOME is not set as Eclipse cannot provide anything meaningfull.
Please verify (Darin W).
Verified.
When I ran our "export plugins" script with an external Ant 1.5.1 installation specified as ANT home, I got this exception: !ENTRY org.eclipse.ant.core 4 1 Nov 11, 2002 15:36:41.679 !MESSAGE XML parser factory has not been configured correctly: Provider for javax.xml.parsers.SAXParserFactory cannot be found !STACK 0 XML parser factory has not been configured correctly: Provider for javax.xml.parsers.SAXParserFactory cannot be found at org.apache.tools.ant.util.JAXPUtils.newParserFactory (JAXPUtils.java:114) at org.apache.tools.ant.util.JAXPUtils.getParserFactory (JAXPUtils.java:99) at org.apache.tools.ant.util.JAXPUtils.newSAXParser(JAXPUtils.java:160) at org.apache.tools.ant.util.JAXPUtils.getXMLReader(JAXPUtils.java:146) at org.apache.tools.ant.helper.ProjectHelperImpl.parse (ProjectHelperImpl.java:136) at org.apache.tools.ant.ProjectHelper.configureProject (ProjectHelper.java:117) at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseScript (InternalAntRunner.java:261) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run (InternalAntRunner.java:502) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run (InternalAntRunner.java:323) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:312) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:380) at org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate $1.run(AntLaunchDelegate.java:145) at java.lang.Thread.run(Thread.java:512) --- Nested Exception --- javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.SAXParserFactory cannot be found at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source) at org.apache.tools.ant.util.JAXPUtils.newParserFactory (JAXPUtils.java:112) at org.apache.tools.ant.util.JAXPUtils.getParserFactory (JAXPUtils.java:99) at org.apache.tools.ant.util.JAXPUtils.newSAXParser(JAXPUtils.java:160) at org.apache.tools.ant.util.JAXPUtils.getXMLReader(JAXPUtils.java:146) at org.apache.tools.ant.helper.ProjectHelperImpl.parse (ProjectHelperImpl.java:136) at org.apache.tools.ant.ProjectHelper.configureProject (ProjectHelper.java:117) at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseScript (InternalAntRunner.java:261) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run (InternalAntRunner.java:502) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run (InternalAntRunner.java:323) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:312) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:380) at org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate $1.run(AntLaunchDelegate.java:145) at java.lang.Thread.run(Thread.java:512) When I then tried to open the preference page to change the classpath, I got this exception: !ENTRY org.eclipse.ui 4 4 Nov 11, 2002 15:37:26.344 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Nov 11, 2002 15:37:26.354 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at java.net.URLStreamHandler.sameFile(URLStreamHandler.java(Compiled Code)) at java.net.URL.sameFile(URL.java:755) at org.eclipse.ui.externaltools.internal.ant.preferences.AntClasspathPage$AntClassp athContentProvider.add(AntClasspathPage.java:609) at org.eclipse.ui.externaltools.internal.ant.preferences.AntClasspathPage.setAntHom e(AntClasspathPage.java:234) at org.eclipse.ui.externaltools.internal.ant.preferences.AntClasspathPage.access$3 (AntClasspathPage.java:218) at org.eclipse.ui.externaltools.internal.ant.preferences.AntClasspathPage$2.modifyT ext(AntClasspathPage.java:361) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:181) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:1786) at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:2841) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java(Compiled Code)) at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:92) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.SetWindowTextW(Native Method) at org.eclipse.swt.internal.win32.OS.SetWindowText(OS.java:1850) at org.eclipse.swt.widgets.Text.setText(Text.java:1348) at org.eclipse.ui.externaltools.internal.ant.preferences.AntClasspathPage.initializ e(AntClasspathPage.java:280) at org.eclipse.ui.externaltools.internal.ant.preferences.AntPreferencePage.createCo ntents(AntPreferencePage.java:82) at org.eclipse.jface.preference.PreferencePage.createControl (PreferencePage.java:205) at org.eclipse.jface.preference.PreferenceDialog.showPage (PreferenceDialog.java:918) at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem (PreferenceDialog.java:609) at org.eclipse.jface.preference.PreferenceDialog.createContents (PreferenceDialog.java:269) at org.eclipse.jface.window.Window.create(Window.java:281) at org.eclipse.ui.internal.OpenPreferencesAction.run (OpenPreferencesAction.java:45) at org.eclipse.jface.action.Action.runWithEvent(Action.java:769) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:408) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:362) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:353) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:48) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1402) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:831) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
I was unable to open the pref page even after re-starting my workspace (I got the same exception).
Fixed NPE in property page, but the other problem still exists ("XML parser factory has not been configured correctly: Provider for javax.xml.parsers.SAXParserFactory cannot be found")
I cannot reproduce the problem. I updated all of my plugins using the latest code. In my host, and using launch configs, "export plugins" worked as expected. Were you selfhosting and the exception occurs in your target? BTW, I agree with your fix for the NPE, but why were you not finding a tools.jar?
This looks like a dup of bug 23239...appears to be a problem with attempting to use different xerces (and the problem will then depend on whether xerces has already been loaded by the plugin class loader or the ant class loader). From http://eclipsewiki.swiki.net/118#ant15, it is recommended to remove a classpath entry from the manifest.mf file?
marking this bug as fixed. Leaving bug 23239 open.