tags:

views:

28

answers:

1

I m using Eclipse 3.4.2 whenever I run my ant build it fails with the following exception

Unexpected element "{}target" {antlib:org.apache.tools.ant}target

Please let me know what I m missing on.

A: 

I can reproduce this problem by putting a target outside the project element that is required in ant build files. The error indicates that there is a fault in your build file - something (a target element) in the wrong place.

This build throws that error:

<?xml version="1.0"?>
    <target name="wibble" />
<project name="stack_overflow">
</project>

Whereas this does not:

<?xml version="1.0"?>
<project name="stack_overflow">
    <target name="wibble" />
</project>

In the full error message you should get a line number to guide you to the point in the file needing attention:

#   line number here
#         v
build.xml:2: Unexpected element "{}target" {antlib:org.apache.tools.ant}target
martin clayton