Bug 21809 - Let user specify installation directory of Ant
Summary: Let user specify installation directory of Ant
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Darin Swanson CLA
QA Contact:
URL:
Whiteboard:
Keywords: core
Depends on:
Blocks:
 
Reported: 2002-07-23 10:44 EDT by Knut Wannheden CLA
Modified: 2002-11-15 12:43 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 Knut Wannheden CLA 2002-07-23 10:44:42 EDT
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.
Comment 1 Rodrigo Peretti CLA 2002-07-24 09:18:24 EDT
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
Comment 2 Darin Swanson CLA 2002-11-04 18:13:42 EST
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.
Comment 3 Darin Swanson CLA 2002-11-04 18:14:49 EST
Please verify (Darin W).
Comment 4 Darin Wright CLA 2002-11-11 16:29:24 EST
Verified.
Comment 5 Darin Wright CLA 2002-11-11 16:32:46 EST
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)
Comment 6 Darin Wright CLA 2002-11-11 16:37:49 EST
I was unable to open the pref page even after re-starting my workspace (I got 
the same exception).
Comment 7 Darin Wright CLA 2002-11-11 17:01:51 EST
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")
Comment 8 Darin Swanson CLA 2002-11-12 21:53:15 EST
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?
Comment 9 Darin Swanson CLA 2002-11-12 22:09:39 EST
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? 
Comment 10 Darin Wright CLA 2002-11-15 12:42:53 EST
marking this bug as fixed. Leaving bug 23239 open.
Comment 11 Darin Wright CLA 2002-11-15 12:43:03 EST
Verified.