1.8.2 build.xml 中需要 ant-contrib,但会导致错误
我发现我需要在 build.xml 中添加以下内容:
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${ant.library.dir}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
为了支持 ant-contrib
什么“名称”实际上是“未定义”?我非常想了解如何解决这个问题。谷歌搜索,我看到其他人也有相同或类似的问题,但没有人给出好的答案,至少不适合我的情况。
非常感谢您对这个问题的任何评论,
Russ
I find I need the following in build.xml:
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${ant.library.dir}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
in order to support the ant-contrib <if> ... </if> construct I'm using. However, Eclipse is very grumpy about this. With this section at the top of build.xml, everything works perfectly, whether from the command line outside of Eclipse or inside Eclipse, despite the grumpiness:
What "name" is in fact "undefined"? I would dearly like to understand what to do about this problem. Googling, I see others have had identical or similar problems, but no one's given a good answer, at least not that fits my situation.
Profuse thanks for any comments on this problem,
Russ
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了这里描述的问题和简单的解决方法: http:// www.mail-archive.com/[email protected]/msg39536.html
我使用以下构建文件确认了这一点:
如果在 taskdef 之前没有属性声明,Eclipse 会抱怨。
我尝试的另一个解决方法是将任务定义移动到目标中。这也有效:
I found the issue and simple work around described here: http://www.mail-archive.com/[email protected]/msg39536.html
I confirmed that with the following build file:
If you don't have a property declaration before the taskdef, Eclipse complains.
Another work around I tried was to move the taskdef into a target. That worked too:
我不知道我这样做的方式是否只是样式,但是如果您做了类似为类路径创建一个单独的元素之类的事情,例如:
然后在类似 @FailedDev 的行中建议利用
classpathref< /code> 属性?:
?
或者,我发现另一件事说对于 ANT 版本 1.6+ 使用
antlib.xml
而不是antcontrib.properties
?编辑:
我很难确定此链接在哪个产品中解决了该问题,但如果没有其他问题,此特定评论中的一些片段可能会为您提供合适的解决方法 - 尽管也许它们就是您上面所说的
https://bugzilla.redhat.com/show_bug.cgi?id=663236#c2
I don't know if the way I do it is just style or not, but what if you did something like creating a separate element for the classpath like:
And then later on a line like @FailedDev suggested leveraging the
classpathref
attribute?:?
Or, I found one other thing which says to use
antlib.xml
instead ofantcontrib.properties
for ANT versions 1.6+?Edit:
I'm having a hard time determining in which product this link fixed the issue, but if nothing else there are a couple snippets in this specific comment which may provide a suitable workaround for you -- although maybe they're what you're referring to above when you say
https://bugzilla.redhat.com/show_bug.cgi?id=663236#c2