Bug 182149 - Error occurred when running J2EE Ant tasks in eclipse 3.x
Summary: Error occurred when running J2EE Ant tasks in eclipse 3.x
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-04-12 11:16 EDT by Steven Jin CLA
Modified: 2019-09-06 16:15 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Jin CLA 2007-04-12 11:16:32 EDT
Numerous customers have reported the following issus as they migrate their development environment from products built upon eclispe 2.x (e.g. WSAD 5.1) to products built upon eclipse 3.x (e.g. RAD7).

Using the default settings in the Ant launch config, running any J2EE Ant tasks (e.g. warExport) results in the following error:
========================================
BUILD FAILED
C:\Program Files\IBM\SDP70\workspace_new\classifieds\build\build.xml:14: Could not create task or type of type: warExport.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual 
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file: 
 - You have misspelt 'warExport'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
     and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and the JAR file and/or libraries
     implementing the functionality were not found at the time you
     yourself built your installation of Ant from the Ant sources.
   Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
     task and make sure it contains more than merely a META-INF/MANIFEST.MF.
     If all it contains is the manifest, then rebuild Ant with the needed
     libraries present in ${ant.home}/lib/optional/ , or alternatively,
     download a pre-built release version from apache.org
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task 
     and needs to be declared using <taskdef>.
 - You are attempting to use a task defined using 
    <presetdef> or <macrodef> but have spelt wrong or not 
   defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
========================================

This issue is caused by the change made in Bug 45899, which makes build in separate JRE the default setting. By switching to "Run in the same JRE as the workspace", the problem is resolved. But as you can see, the suggestions listed in the error log (if not misleading) does not really point the user to the right direction.
Comment 1 Darin Swanson CLA 2007-04-12 11:29:16 EDT
The error message itself is coming from Ant which does not know that it is embedded within Eclipse.

An enhancement would be to potentially look for this type of build failure and attempt to append some Eclipse specific indication of what could be wrong.
Comment 2 Darin Wright CLA 2007-09-07 12:18:07 EDT
Steven - is the workaround to this to add the appropriate jar to the Ant classpath so that Ant can find the task? Would it be possible for the tooling that requires J2EE to add the appropriate jar to the ant classpath using the org.eclipse.ant.core.extraClasspathEntries extension point?
Comment 3 Darin Wright CLA 2007-09-07 15:55:53 EDT
My first comment was trying to solve the reason for the error message - however, on second look, it sounds like this bug report is asking for a better error message. As pointed out by Darin (S), the message is coming from Ant, which does not know about Eclipse. Nothing we can do for 3.3.1.
Comment 4 Steven Jin CLA 2007-09-11 17:43:54 EDT
Darin,

The workaround is to switch to "Run in the same JRE as the workspace". 

This bug is opened for a better error message, which can point the user to the correct *simple* workaround, rather than the current message which is not very helpful.
Comment 5 Mike Wilson CLA 2008-03-27 13:46:44 EDT
Has anything happened on this?
Comment 6 Darin Swanson CLA 2008-03-27 13:56:06 EDT
No work is planned for 3.4
Comment 7 Eclipse Webmaster CLA 2019-09-06 16:15:23 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.