| java.lang.Object org.apache.ivy.Ivy
Ivy | public class Ivy (Code) | | 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
Ivy.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;
}
});
|
Inner Class :public static interface IvyCallback | |
Constructor Summary | |
public | Ivy() The default constructor of Ivy allows to create an instance of Ivy with none of its
dependencies (engines, settings, ...) created. |
Method Summary | |
public void | bind() This method is used to bind this Ivy instance to required dependencies, i.e. | public boolean | check(URL ivyFile, String resolvername) | public void | checkInterrupted() | public void | configure(File settingsFile) | public void | configure(URL settingsURL) | public void | configureDefault() | public void | configureDefault14() | public void | deliver(ModuleRevisionId mrid, String revision, String destIvyPattern) | public void | deliver(String revision, String destIvyPattern, DeliverOptions options) | public void | deliver(ModuleRevisionId mrid, String revision, String destIvyPattern, DeliverOptions options) | public Object | execute(IvyCallback callback) Executes the given callback in the context of this Ivy instance. | public ResolvedModuleRevision | findModule(ModuleRevisionId mrid) | public CheckEngine | getCheckEngine() | public DeliverEngine | getDeliverEngine() | public EventManager | getEventManager() | public InstallEngine | getInstallEngine() | public static String | getIvyDate() Returns the date at which this version of Ivy has been built. | public static String | getIvyHomeURL() Returns the URL at which Ivy web site can be found. | public static String | getIvyVersion() Returns the current version of Ivy, as displayed on the console when
Ivy is initialized. | public MessageLoggerEngine | getLoggerEngine() | public PublishEngine | getPublishEngine() | public RepositoryManagementEngine | getRepositoryEngine() | public ResolutionCacheManager | getResolutionCacheManager() | public ResolveEngine | getResolveEngine() | public RetrieveEngine | getRetrieveEngine() | public SearchEngine | getSearchEngine() | public IvySettings | getSettings() | public SortEngine | getSortEngine() | public String | getVariable(String name) | public static String | getWorkingRevision() | public ResolveReport | install(ModuleRevisionId mrid, String from, String to, boolean transitive, boolean validate, boolean overwrite, Filter artifactFilter, String matcherName) | public void | interrupt() | public void | interrupt(Thread operatingThread) | public synchronized boolean | isInterrupted() | public ModuleEntry[] | listModuleEntries(OrganisationEntry org) | public ModuleId[] | listModules(ModuleId criteria, PatternMatcher matcher) | public ModuleRevisionId[] | listModules(ModuleRevisionId criteria, PatternMatcher matcher) | public String[] | listModules(String org) | public OrganisationEntry[] | listOrganisationEntries() | public String[] | listOrganisations() | public RevisionEntry[] | listRevisionEntries(ModuleEntry module) | public String[] | listRevisions(String org, String module) | public String[] | listTokenValues(String token, Map otherTokenValues) | public static Ivy | newInstance() | public static Ivy | newInstance(IvySettings settings) | public void | popContext() Pops the current Ivy context. | public Collection | publish(ModuleRevisionId mrid, Collection srcArtifactPattern, String resolverName, PublishOptions options) | public void | pushContext() Pushes a new IvyContext bound to this Ivy instance if the current context is not already
bound to this Ivy instance. | public ResolveReport | resolve(File ivySource) | public ResolveReport | resolve(URL ivySource) | public ResolveReport | resolve(ModuleRevisionId mrid, ResolveOptions options, boolean changing) | public ResolveReport | resolve(URL ivySource, ResolveOptions options) | public ResolveReport | resolve(ModuleDescriptor md, ResolveOptions options) | public int | retrieve(ModuleRevisionId mrid, String destFilePattern, RetrieveOptions options) | public void | setCheckEngine(CheckEngine checkEngine) | public void | setDeliverEngine(DeliverEngine deliverEngine) | public void | setEventManager(EventManager eventManager) | public void | setInstallEngine(InstallEngine installEngine) | public void | setPublishEngine(PublishEngine publishEngine) | public void | setRepositoryEngine(RepositoryManagementEngine repositoryEngine) | public void | setResolveEngine(ResolveEngine resolveEngine) | public void | setRetrieveEngine(RetrieveEngine retrieveEngine) | public void | setSearchEngine(SearchEngine searchEngine) | public void | setSettings(IvySettings settings) | public void | setSortEngine(SortEngine sortEngine) | public void | setVariable(String varName, String value) | public List | sortModuleDescriptors(Collection moduleDescriptors, NonMatchingVersionReporter nonMatchingVersionReporter) Sorts the given ModuleDescriptors from the less dependent to the more dependent. | public List | sortNodes(Collection nodes) | public String | substitute(String str) |
Ivy | public Ivy()(Code) | | The default constructor of Ivy allows to create an instance of Ivy with none of its
dependencies (engines, settings, ...) created. If you use this constructor, it's your
responsibility to set the dependencies of Ivy using the appropriate setters
(setResolveEngine, ...). You can also call the bind method to set all the dependencies except
those that you have provided using the setters. If you want to get an instance ready to use,
prefer the use of Ivy.newInstance().
|
bind | public void bind()(Code) | | This method is used to bind this Ivy instance to required dependencies, i.e. instance of
settings, engines, and so on.
After this call Ivy is still not configured, which means that
the settings object is still empty.
|
checkInterrupted | public void checkInterrupted()(Code) | | Check if the current operation has been interrupted, and if it is the case, throw a runtime
exception
|
execute | public Object execute(IvyCallback callback)(Code) | | Executes the given callback in the context of this Ivy instance.
Alternatively you can use the
Ivy.pushContext() and
Ivy.popContext() methods, but
this is not recommended:
Object result = null;
pushContext();
try {
result = callback.doInIvyContext(this, IvyContext.getContext());
} finally {
popContext();
}
doSomethingWithResult(result);
Parameters: callback - |
getIvyDate | public static String getIvyDate()(Code) | | Returns the date at which this version of Ivy has been built.
May be empty if unknown.
the date at which this version of Ivy has been built See Also: Ivy.getIvyVersion() |
getIvyHomeURL | public static String getIvyHomeURL()(Code) | | Returns the URL at which Ivy web site can be found.
the URL at which Ivy web site can be found |
getIvyVersion | public static String getIvyVersion()(Code) | | Returns the current version of Ivy, as displayed on the console when
Ivy is initialized.
the current version of Ivy See Also: Ivy.getIvyVersion() |
getWorkingRevision | public static String getWorkingRevision()(Code) | | |
interrupt | public void interrupt()(Code) | | Interrupts the current running operation, no later than interruptTimeout milliseconds after
the call
|
interrupt | public void interrupt(Thread operatingThread)(Code) | | Interrupts the current running operation in the given operating thread, no later than
interruptTimeout milliseconds after the call
|
isInterrupted | public synchronized boolean isInterrupted()(Code) | | |
newInstance | public static Ivy newInstance()(Code) | | |
pushContext | public void pushContext()(Code) | | Pushes a new IvyContext bound to this Ivy instance if the current context is not already
bound to this Ivy instance. If the current context is already bound to this Ivy instance, it
pushes the current context on the context stack, so that you can (and must) always call
Ivy.popContext() when you're done.
Alternatively, you can use the
Ivy.execute(org.apache.ivy.Ivy.IvyCallback) method which
takes care of everything for you.
|
sortModuleDescriptors | public List sortModuleDescriptors(Collection moduleDescriptors, NonMatchingVersionReporter nonMatchingVersionReporter)(Code) | | Sorts the given ModuleDescriptors from the less dependent to the more dependent. This sort
ensures that a ModuleDescriptor is always found in the list before all ModuleDescriptors
depending directly on it.
Parameters: moduleDescriptors - a Collection of ModuleDescriptor to sort Parameters: nonMatchingVersionReporter - Used to report some non matching version (when a modules depends on a specificrevision of an other modules present in the of modules to sort with a differentrevision. a List of sorted ModuleDescriptors |
sortNodes | public List sortNodes(Collection nodes)(Code) | | Sorts the collection of IvyNode from the less dependent to the more dependent
|
|
|