Ivy: Attaching sources and docs to libraries in Eclipse

Jun 17, 2010   #ant  #build  #eclipse  #ivy  #java 

With Apache Ivy you can manage your project’s library dependencies.

Jing Xue put together a nice Ant task that can generate the classpath configuration for Eclipse based on the dependency resolution of Ivy.

Ivy is also capable of retrieving sources and docs of the libraries your project depends on. The Ant task can attach sources to the libraries in Eclipse. It cannot attach documentation files.

I’ve extended Jing’s source in the following ways:

  • It can attach docs to the resolved libraries. The default extension for autodetection of a doc library is -docs. When you have a library called thelib-1.1.jar the doc library must be named thelib-docs-1.1.jar. The default extension can be overridden by specifying <ivyeclipse docappendix="-YOUREXT"... in your target definition.
  • It is more flexible regarding naming of the source libraries. The original task required naming the source and the library artifact identically. The extended task defaults to -src for source libraries. The default can be overridden with <ivyeclipse srcappendix="-YOUREXT"...

Get the extended task source code: EclipseClasspath