Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Ant - Target does not exist in this project(Error message when imports are done via macrodefs)
Ant - Target does not exist in this project [message #831802] Thu, 29 March 2012 11:22 Go to next message
Fat Bear Incorporated is currently offline Fat Bear IncorporatedFriend
Messages: 5
Registered: July 2010
Location: Raleigh, NC
Junior Member
In my ant code, imports are being done from inside a macrodef to facilitate a smarter import facility with other capabilities (e.g., importing a file via a package name that searches a set of import directories until one is found). So, I have essentially:

<myimport package="packagename" .../>

The problem is that Eclipse is marking target lines with red X's (errors) with the message "Target does not exist in this project":

<target name="main" depends=""/>

This is because the target "" is in one of the files imported via the <myimport> macrodef.

Is there any way to get Eclipse to stop identifying lines such as the above as errors?

Steve Amerige, Fat Bear Incorporated
Web Engineering | Graphic Design | Creative Marketing
Website, Java, and Source-Code Hosting
Re: Ant - Target does not exist in this project [message #832009 is a reply to message #831802] Thu, 29 March 2012 16:32 Go to previous messageGo to next message
Michael Rennie is currently offline Michael RennieFriend
Messages: 67
Registered: July 2009
Location: Canada
This should be working. A trick to try can be to close + reopen the Ant editor - sometimes there are issues with reconciling the buildfile as edits are made.

If the close + reopen trick does not help you can file a bug against platform Ant. If you do file a bug please attach a complete example buildfile with all dependents, etc.
Re: Ant - Target does not exist in this project [message #950128 is a reply to message #831802] Fri, 19 October 2012 17:01 Go to previous messageGo to next message
Martin Lansche is currently offline Martin LanscheFriend
Messages: 1
Registered: October 2012
Junior Member
I am seeing this behaviour with this simple set of scripts:

in nested.xml, I have:

<?eclipse.ant.import ?>

<target name="echo">
<fail message="Missing parameter [uid]" unless="uid"/>
<echo>Hello ${uid}</echo>


In including.xml, I have:

<project default="testincluding">

<include file="nested.xml" as="nested"/>

<target name="testincluding" depends="nested.echo"/>


Eclipse Platform

Version: 3.6.3.r362_v20110302-9gF78GsCFrIGnIGHpoPftwjnBiA8C-TZRswZYu
shows Red X on the
<target name="testincluding" depends="nested.echo"/>
line, saying that
Target nested.echo does not exist in this project.

Yet the ANT build runs as expected.

I am seeing the same behaviour on Eclipse 3.7.0

The version of ANT is 1.8.2, but that should not make a difference. I have configured my ANT_HOME to be the 1.8.2. The issue is not the execution of the script, but the flagging as error the included targets.

FWIW, if I change to
<import file="nested.xml" as="nested"/>
I also see a warning that
import doesn't support the "as" attribute.

Re: Ant - Target does not exist in this project [message #1767505 is a reply to message #831802] Thu, 06 July 2017 14:52 Go to previous message
Janac Meenachisundaram is currently offline Janac MeenachisundaramFriend
Messages: 1
Registered: July 2017
Junior Member
I am still seeing the same issue. My eclipse installation:

Eclipse Java EE IDE for Web Developers.

Version: Neon.3 Release (4.6.3)
Build id: 20170314-1500

Previous Topic:AERI NullPointerException
Next Topic:Shell Script(DLTK)
Goto Forum:

Current Time: Sat Feb 22 23:58:25 GMT 2020

Powered by FUDForum. Page generated in 0.03525 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top