如何在 Eclipse 自动内容辅助中使用 ant-contrib 任务 [英] how to use ant-contrib tasks in eclipse auto content assist

查看:21
本文介绍了如何在 Eclipse 自动内容辅助中使用 ant-contrib 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Eclipse Ganymede 并且想使用 ant 的自动内容辅助功能.我有 ant-contrib-1.0b3.jar .

I have Eclipse Ganymede and would like to use the auto content assist feature for ant. I have the ant-contrib-1.0b3.jar with me.

eclipse 中需要什么配置才能使用自动内容辅助,其中还可以包括 ant-contrib 的任务?

What configuration is required in eclipse to use auto content assist which can include tasks for ant-contrib as well?

当我使用以下内容时,ant 可以识别 ant-contrib 的任务,但内容辅助不起作用?

When I use the following the ant can recognize tasks for ant-contrib but content assist doesn't work?

<!-- Define classpath for ant-contrib tasks -->
<path id="ant.contrib.classpath">
    <fileset dir="/path/to/lib/">
        <include name="ant-contrib-1.0b3.jar" />
    </fileset>
</path>

<!-- Task definition -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath refid="ant.contrib.classpath" />
</taskdef>

推荐答案

请尝试以下操作.

我知道对于 Ant 1.6 及更高版本,您需要像这样引用 antcontrib XML 文件而不是属性文件:

I understand that for Ant 1.6 and later you need to reference the antcontrib XML file instead of the properties file like so :

<!-- Task definition -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath refid="ant.contrib.classpath" />
</taskdef>

这也是此处的详细信息.

This is also detailed here.

除此之外,在Preferences ->蚂蚁 ->编辑器->Content Assist 检查为用户定义的任务提供建议 是这样检查的(这也是默认设置):

Besides that, in Preferences -> Ant -> Editor -> Content Assist check that Provide proposals for user defined tasks is checked like so (this is also the default) :

如果上述两个都到位,您应该获得如下所示的内容帮助(这是您帖子中的代码,唯一的区别是,它已经替换了对 antcontrib.properties 的引用使用 antlib.xml) :

If both of the above are in place you should get the content assist as shown here (This is the code from your post, the only difference being, that have replaced the reference to antcontrib.properties with antlib.xml) :

在 Eclipse Indigo SR2(64 位)上用 xml 替换对属性文件的引用对我来说完全不同.

Replacing the reference to the properties file with the xml one made all the difference for me on Eclipse Indigo SR2 (64 Bit).

我检查以确保此功能(用户定义的 ant 任务的内容辅助)从 Eclipse 3.3 开始至少可用.Ant 编辑器中存在与 Eclipse 3.3 中的此功能相关的性能问题,但此后已解决.

I checked to make sure that this feature ( Content assist for user-defined ant tasks) is available at least since Eclipse 3.3. There were performance problems in the Ant Editor related specifically to this feature in Eclipse 3.3 but the same have since been resolved.

这篇关于如何在 Eclipse 自动内容辅助中使用 ant-contrib 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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