org.apache.ivy
public class Ivy extends Object
This class is the main class of Ivy, which acts as a Facade to all services offered by Ivy:
Ivy ivy = Ivy.newInstance(); ivy.configure(new URL("ivysettings.xml")); ivy.resolve(new URL("ivy.xml"));
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 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; } });
Nested Class Summary | |
---|---|
static interface | Ivy.IvyCallback
Callback used to execute a set of Ivy related methods within an IvyContext.
|
Field Summary | |
---|---|
static SimpleDateFormat | DATE_FORMAT |
Constructor Summary | |
---|---|
Ivy()
The default constructor of Ivy allows to create an instance of Ivy with none of its
dependencies (engines, settings, ...) created. |
Method Summary | |
---|---|
void | bind()
This method is used to bind this Ivy instance to required dependencies, i.e. instance of
settings, engines, and so on.
|
boolean | check(URL ivyFile, String resolvername) |
void | checkInterrupted()
Check if the current operation has been interrupted, and if it is the case, throw a runtime
exception |
void | configure(File settingsFile) |
void | configure(URL settingsURL) |
void | configureDefault() |
void | configureDefault14()
Configures Ivy with 1.4 compatible default settings |
void | deliver(ModuleRevisionId mrid, String revision, String destIvyPattern) |
void | deliver(String revision, String destIvyPattern, DeliverOptions options) |
void | deliver(ModuleRevisionId mrid, String revision, String destIvyPattern, DeliverOptions options)
Example of use: deliver(mrid, "1.5", "target/ivy/ivy-[revision].xml",
DeliverOptions.newInstance(settings).setStatus("release").setValidate(false));
|
Object | execute(Ivy.IvyCallback callback)
Executes the given callback in the context of this Ivy instance.
|
ResolvedModuleRevision | findModule(ModuleRevisionId mrid) |
CheckEngine | getCheckEngine() |
DeliverEngine | getDeliverEngine() |
EventManager | getEventManager() |
InstallEngine | getInstallEngine() |
static String | getIvyDate()
Returns the date at which this version of Ivy has been built.
|
static String | getIvyHomeURL()
Returns the URL at which Ivy web site can be found. |
static String | getIvyVersion()
Returns the current version of Ivy, as displayed on the console when
Ivy is initialized.
|
MessageLoggerEngine | getLoggerEngine() |
PublishEngine | getPublishEngine() |
RepositoryManagementEngine | getRepositoryEngine() |
ResolutionCacheManager | getResolutionCacheManager() |
ResolveEngine | getResolveEngine() |
RetrieveEngine | getRetrieveEngine() |
SearchEngine | getSearchEngine() |
IvySettings | getSettings() |
SortEngine | getSortEngine() |
String | getVariable(String name) |
static String | getWorkingRevision() |
ResolveReport | install(ModuleRevisionId mrid, String from, String to, InstallOptions options) |
void | interrupt()
Interrupts the current running operation, no later than interruptTimeout milliseconds after
the call |
void | interrupt(Thread operatingThread)
Interrupts the current running operation in the given operating thread, no later than
interruptTimeout milliseconds after the call |
boolean | isInterrupted() |
ModuleEntry[] | listModuleEntries(OrganisationEntry org) |
ModuleId[] | listModules(ModuleId criteria, PatternMatcher matcher) |
ModuleRevisionId[] | listModules(ModuleRevisionId criteria, PatternMatcher matcher) |
String[] | listModules(String org) |
OrganisationEntry[] | listOrganisationEntries() |
String[] | listOrganisations() |
RevisionEntry[] | listRevisionEntries(ModuleEntry module) |
String[] | listRevisions(String org, String module) |
String[] | listTokenValues(String token, Map otherTokenValues) |
static Ivy | newInstance() |
static Ivy | newInstance(IvySettings settings) |
void | popContext()
Pops the current Ivy context.
|
Collection | publish(ModuleRevisionId mrid, Collection srcArtifactPattern, String resolverName, PublishOptions options) |
void | pushContext()
Pushes a new IvyContext bound to this Ivy instance if the current context is not already
bound to this Ivy instance. |
ResolveReport | resolve(File ivySource) |
ResolveReport | resolve(URL ivySource) |
ResolveReport | resolve(ModuleRevisionId mrid, ResolveOptions options, boolean changing) |
ResolveReport | resolve(URL ivySource, ResolveOptions options) |
ResolveReport | resolve(ModuleDescriptor md, ResolveOptions options) |
int | retrieve(ModuleRevisionId mrid, String destFilePattern, RetrieveOptions options) |
void | setCheckEngine(CheckEngine checkEngine) |
void | setDeliverEngine(DeliverEngine deliverEngine) |
void | setEventManager(EventManager eventManager) |
void | setInstallEngine(InstallEngine installEngine) |
void | setPublishEngine(PublishEngine publishEngine) |
void | setRepositoryEngine(RepositoryManagementEngine repositoryEngine) |
void | setResolveEngine(ResolveEngine resolveEngine) |
void | setRetrieveEngine(RetrieveEngine retrieveEngine) |
void | setSearchEngine(SearchEngine searchEngine) |
void | setSettings(IvySettings settings) |
void | setSortEngine(SortEngine sortEngine) |
void | setVariable(String varName, String value) |
List | sortModuleDescriptors(Collection moduleDescriptors, SortOptions options)
Sorts the given ModuleDescriptors from the less dependent to the more dependent. |
List | sortNodes(Collection nodes, SortOptions options)
Sorts the collection of IvyNode from the less dependent to the more dependent |
String | substitute(String str) |
After this call Ivy is still not configured, which means that the settings object is still empty.
Parameters: mrid revision destIvyPattern options
Throws: IOException ParseException
Alternatively you can use the pushContext and popContext methods, but this is not recommended:
Object result = null; pushContext(); try { result = callback.doInIvyContext(this, IvyContext.getContext()); } finally { popContext(); } doSomethingWithResult(result);
Parameters: callback
Returns:
May be empty if unknown.
Returns: the date at which this version of Ivy has been built
Returns: the URL at which Ivy web site can be found
Returns: the current version of Ivy
You must call this method once and only once for each call to pushContext, when you're done with the your Ivy related work.
Alternatively, you can use the execute method which takes care of everything for you.
Alternatively, you can use the execute method which takes care of everything for you.
Parameters: moduleDescriptors a Collection of ModuleDescriptor to sort options Options to use to sort the descriptors.
Returns: a List of sorted ModuleDescriptors
Throws: CircularDependencyException if a circular dependency exists and circular dependency strategy decide to throw an exception