如何修复“意外元素“{}目标"?{antlib:org.apache.tools.ant}target' 我的 Ant 构建中的错误? [英] How do I fix 'Unexpected element "{}target" {antlib:org.apache.tools.ant}target' errors in my Ant build?

查看:37
本文介绍了如何修复“意外元素“{}目标"?{antlib:org.apache.tools.ant}target' 我的 Ant 构建中的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 Ant 构建时,它失败并出现以下异常:

When I run my Ant build it fails with the following exception:

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

我使用的是 Eclipse 3.4.2.

I'm using Eclipse 3.4.2.

请让我知道我在这里遗漏了什么.

Please let me know what I'm missing here.

推荐答案

我可以通过将 target 放在 ant build 所需的 project 元素之外来重现这个问题文件.该错误表明您的构建文件中存在错误 - 某些(target 元素)位于错误的位置.

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.

此构建引发该错误:

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

然而这不是:

<?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

这篇关于如何修复“意外元素“{}目标"?{antlib:org.apache.tools.ant}target' 我的 Ant 构建中的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆