super.prepareTask();
Message.setShowProgress(showProgress);
}
public void doExecute() throws BuildException {
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
try {
conf = getProperty(conf, settings, "ivy.configurations");
type = getProperty(type, settings, "ivy.resolve.default.type.filter");
String[] confs = splitConfs(conf);
boolean childs = !dependencies.isEmpty() || !excludes.isEmpty() || !conflicts.isEmpty();
ResolveReport report;
if (childs) {
if (isInline()) {
throw new BuildException("the inline mode is incompatible with child elements");
}
if (organisation != null) {
throw new BuildException("'organisation' is not allowed with child elements");
}
if (module != null) {
throw new BuildException("'module' is not allowed with child elements");
}
if (file != null) {
throw new BuildException("'file' not allowed with child elements");
}
if (!getAllowedLogOptions().contains(log)) {
throw new BuildException("invalid option for 'log': " + log
+ ". Available options are " + getAllowedLogOptions());
}
ModuleRevisionId mrid = ModuleRevisionId.newInstance("", "",
Ivy.getWorkingRevision());
DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(mrid, null);
Iterator itDeps = dependencies.iterator();
while (itDeps.hasNext()) {
IvyDependency dep = (IvyDependency) itDeps.next();
DependencyDescriptor dd = dep.asDependencyDescriptor(md, "default", settings);
md.addDependency(dd);
}
Iterator itExcludes = excludes.iterator();
while (itExcludes.hasNext()) {
IvyExclude exclude = (IvyExclude) itExcludes.next();
DefaultExcludeRule rule = exclude.asRule(settings);
rule.addConfiguration("default");
md.addExcludeRule(rule);
}
Iterator itConflicts = conflicts.iterator();
while (itConflicts.hasNext()) {
IvyConflict conflict = (IvyConflict) itConflicts.next();
conflict.addConflict(md, settings);
}
report = ivy
.resolve(md, getResolveOptions(ivy, new String[] {"default"}, settings));
} else if (isInline()) {
if (organisation == null) {
throw new BuildException("'organisation' is required when using inline mode");
}
if (module == null) {
throw new BuildException("'module' is required when using inline mode");
}
if (file != null) {
throw new BuildException("'file' not allowed when using inline mode");
}
if (!getAllowedLogOptions().contains(log)) {
throw new BuildException("invalid option for 'log': " + log
+ ". Available options are " + getAllowedLogOptions());
}
for (int i = 0; i < confs.length; i++) {
if ("*".equals(confs[i])) {
confs[i] = "*(public)";
}
}
if (revision == null) {
revision = "latest.integration";
}
report = ivy.resolve(
ModuleRevisionId.newInstance(organisation, module, branch, revision),
getResolveOptions(ivy, confs, settings), changing);
} else {
if (organisation != null) {
throw new BuildException(
"'organisation' not allowed when not using 'org' attribute");
}
if (module != null) {
throw new BuildException("'module' not allowed when not using 'org' attribute");
}
if (file == null) {
file = getProject().resolveFile(getProperty(settings, "ivy.dep.file"));
}
report = ivy.resolve(file.toURI().toURL(), getResolveOptions(ivy, confs, settings));
}
if (report.hasError()) {
if (failureProperty != null) {
getProject().setProperty(failureProperty, "true");
}