use of org.apache.ivy.plugins.matcher.PatternMatcher in project ant-ivy by apache.
the class IvyListModules method doExecute.
public void doExecute() throws BuildException {
if (organisation == null) {
throw new BuildException("no organisation provided for ivy listmodules task");
}
if (module == null) {
throw new BuildException("no module name provided for ivy listmodules task");
}
if (revision == null) {
throw new BuildException("no revision provided for ivy listmodules task");
}
if (property == null) {
throw new BuildException("no property provided for ivy listmodules task");
}
if (value == null) {
throw new BuildException("no value provided for ivy listmodules task");
}
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
SearchEngine searcher = new SearchEngine(settings);
PatternMatcher patternMatcher = settings.getMatcher(matcher);
ModuleRevisionId[] mrids;
if (resolver == null) {
mrids = searcher.listModules(ModuleRevisionId.newInstance(organisation, module, branch, revision), patternMatcher);
} else {
DependencyResolver depResolver = settings.getResolver(resolver);
if (depResolver == null) {
throw new BuildException("Unknown resolver: " + resolver);
}
mrids = searcher.listModules(depResolver, ModuleRevisionId.newInstance(organisation, module, branch, revision), patternMatcher);
}
for (ModuleRevisionId mrid : mrids) {
String name = IvyPatternHelper.substitute(settings.substitute(property), mrid);
String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrid);
getProject().setProperty(name, value);
}
}
Aggregations