0

I am searching from morning how to include external dependencies/jars in my project buildpath. I am building my project using ant and ivy. Ant is downloading the dependencies and creating a folder named lib in the project root folder. When I am trying to write code and use eclipse auto suggest to see the classes in the downloaded dependencies eclipse is not able to show them. Then I realized that the jars are in lib folder but not in classpath/buildpath. I am new to ant and I don't know an easy way to do this. I used this

<target name="resolve">
    <ivy:retrieve />
    <path id="gwtlibs">
        <fileset dir="lib">
            <include name="*.jar" />
        </fileset>
    </path>
</target>

and even this

<target name="resolve">
    <ivy:retrieve />
    <path id="gwtlibs">
        <fileset dir="lib">
            <include name="*.jar" />
        </fileset>
    </path>
</target>

But all my efforts failed. I could not see any thing like "Referenced libraries" in my project structure. Do I need to manually add the jars downloaded by going to buildpath and and add external jars option? I have experience with maven. When I do a maven build all external dependencies are downloaded and automatically added to project build path. But how I can achieve the same with ant?

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
Krishna Chaitanya
  • 2,533
  • 4
  • 40
  • 74

1 Answers1

0

I would suggest using the ivy cachepath task. Which is designed to create ANT paths using ivy configurations.

For an example of its use see:

For Eclipse integration I would suggest using the ivyIDE plugin, which will ensure Eclipse uses ivy to cofiguration it's internal classpath.

Finally, the following answer has an example of how to generate the Eclipse ".classpath" directly from ANT.

Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185