how to use ant-contrib tasks in eclipse auto content assist

落爺英雄遲暮 提交于 2019-12-12 20:25:05

问题


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.

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

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>

回答1:


Please try the following.

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.

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) :

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) :

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

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.



来源:https://stackoverflow.com/questions/11857906/how-to-use-ant-contrib-tasks-in-eclipse-auto-content-assist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!