Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 37653

Summary: ant.home is not set
Product: [Eclipse Project] Platform Reporter: thierry lach <thierry.lach>
Component: AntAssignee: Darin Wright <darin.eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: danrubel, Darin_Swanson, dlr, knut.wannheden
Version: 2.1   
Target Milestone: 3.0 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
test case none

Description thierry lach CLA 2003-05-15 09:49:01 EDT
Ant documentation includes the statement "When you are executing platform-
specific applications, such as the exec task or the cvs task, the property 
ant.home must be set to the directory containing where you installed Ant. Again 
this is set by the Ant scripts to the value of the ANT_HOME environment 
variable."

As Eclipse would not be able to determine whether or not the ant script 
contains "platform-specific applications", this value should be set by 
Eclipse.  It should be set to the value of "ANT_HOME" if set in the ant 
preferences page, or to the ant plugin directory if it is not set there.
Comment 1 Darin Swanson CLA 2003-05-15 10:54:36 EDT
Do you have a test case that is failing?

In Eclipse 2.1, ant.home is set if it has been set in the ant preference page.
(see InternalAntRunner.processAntHome(boolean))

It is not set to the Ant plugin directory currently but we have bug 37058 to 
consider the work to make this happen.
Comment 2 Daniel Rall CLA 2003-05-15 11:58:35 EDT
See http://issues.whichever.com/scarab/issues/id/SCB765 for some background.
Comment 3 thierry lach CLA 2003-05-15 12:09:30 EDT
Created attachment 4889 [details]
test case

example build.xml showing the problem.
Comment 4 thierry lach CLA 2003-05-15 12:11:24 EDT
I've attached a build file that contains a distillation of the problem.

I realize that in this context setting ant.home in the script to "." would be 
meaningless unless "." were set up correctly as a true ant home.

This script, however, runs as expected when executed as "ant" from a command 
line but fails with the following message when run within eclipse.

   [available] BUILD FAILED: 
file:c:/webroot/source/scarab.omfix/build/build.xml:19: 
C:\webroot\source\scarab.omfix\build\lib not found.


Comment 5 Daniel Rall CLA 2003-05-15 12:48:34 EDT
If you'd like to try this out yourself, you can checkout Scarab using the
following CVSROOT (password: guest):

$ cvs -d :pserver:guest@cvs.tigris.org:/cvs login
Logging in to :pserver:guest@cvs.tigris.org:2401/cvs
CVS password: 
Comment 6 Darin Swanson CLA 2003-05-15 12:51:14 EDT
The link at Comment #2 is requesting a password?
Comment 7 Darin Swanson CLA 2003-05-15 12:53:09 EDT
Nevermind...I should have read more before complaining :-)
Comment 8 Darin Swanson CLA 2003-05-19 11:49:33 EDT
*** Bug 37058 has been marked as a duplicate of this bug. ***
Comment 9 Darin Swanson CLA 2003-07-15 17:15:11 EDT
This will require a reorganization of the org.apache.ant project to include a 
lib directory.
Comment 10 Daniel Rall CLA 2003-07-16 15:08:51 EDT
Darin, would you mind sketching out why the lib directory is required, and how
it should look?
Comment 11 Darin Swanson CLA 2003-07-16 15:24:30 EDT
Apache Ant expects ant.home to be the root dir of the Ant install. It then 
looks for a lib directory to find all of the libraries it requires / uses by 
default.

So you would need to set the ANT_HOME to ..\org.apache.ant and the 
org.apache.ant project would need to have a lib directory that contained the 
ant.jar and the optional.jar (which currently reside at the top level). 
The plugin.xml would need to be updated for the runtime library entries.
Comment 12 thierry lach CLA 2003-07-17 09:34:52 EDT
I suggest one of two options - IMO the first would be preferable as long as it 
doesn't violate any guidelines for packaging eclipse plugins.

1.  Place ant.jar and optional.jar into the lib directory.  This would create 
an ANT_HOME very similar to that which comes with the stand-alone ant.  This 
would require the plugin.xml to reference the jars in the lib directory to 
avoid duplicate jars.

2.  Create an empty lib directory.  This at least would satisfy any build 
scripts which are making assumptions about the ANT_HOME directory structure.


I'm not as concerned about the presence or absence of a lib directory as I am 
the absence of the ant.home variable.

Of more importance might be the absence of the ant.home/etc directory and the 
xsl files contained within.  The example that I attached earlier referencing 
the ant.home/lib directory, while taken from a "real-world" case, is probably 
not as reasonable as a case for providing the etc directory.
Comment 13 Knut Wannheden CLA 2003-08-05 04:08:37 EDT
If you intend to reorganize the plugin layout anyway, I suggest that you also 
add the bin directory.  The bin directory is actually used by Ant's <exec> task 
if the vmlauncher attribute is set to "false".  In that case <exec> will use a 
platform specific script (e.g. antRun.bat) to execute the external command.
Comment 14 Darin Swanson CLA 2003-08-25 19:13:27 EDT
I intend to release this immediately after the M3 build for inclusion in M4.
This will include the lib and bin directories.
Comment 15 Darin Swanson CLA 2003-08-28 18:27:41 EDT
Added the bin directory and the 3 wrapper scripts.
Created the lib directory and moved ant.jar and optional.jar
Changes to .classpath, .cvsignore, about.html, build.properties

Updated our buildfiles that had path references to /org.apache.ant/ant.jar
Updated the ant core tests.
Comment 16 Darin Swanson CLA 2003-08-28 18:36:00 EDT
As well as changes to AntCorePreferences.
Please verify Darinw.
Comment 17 Darin Swanson CLA 2003-08-28 18:47:08 EDT
Also changes to AntClasspathTab, AntClasspathBlock, and AntClasspathPage.
Comment 18 Darin Swanson CLA 2003-08-29 11:02:00 EDT
As well changes to org.eclipse.ant.core and org.eclipse.ant.ui build.properties
Comment 19 Darin Wright CLA 2003-09-08 22:46:17 EDT
Verified.