Question

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>
Était-ce utile?

La solution

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

enter image description here

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

enter image description here

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top