Class Ivy

java.lang.Object
org.apache.ivy.Ivy

public class Ivy extends Object
Ivy is a free java based dependency manager.

This class is the main class of Ivy, which acts as a Facade to all services offered by Ivy:

  • resolve dependencies
  • retrieve artifacts to a local location
  • deliver and publish modules
  • repository search and listing
Here is one typical usage:
 Ivy ivy = Ivy.newInstance();
 ivy.configure(new URL("ivysettings.xml"));
 ivy.resolve(new URL("ivy.xml"));
 

Using Ivy engines directly

If the methods offered by the Ivy class are not flexible enough and you want to use Ivy engines directly, you need to call the methods within a single IvyContext associated to the Ivy instance you use.

To do so, it is recommended to use the execute(org.apache.ivy.Ivy.IvyCallback) method like this:

 Ivy ivy = Ivy.newInstance();
 ivy.execute(new IvyCallback() {
     public Object doInIvyContext(Ivy ivy, IvyContext context) {
         // obviously we can use regular Ivy methods in the callback
         ivy.configure(new URL("ivysettings.xml"));
         // and we can safely use Ivy engines too
         ivy.getResolveEngine().resolve(new URL("ivy.xml"));
         return null;
     }
 });