}
public void execute()
throws BuildException {
Ivy ivy = new Ivy();
DependencyResolver resolver = null;
Repository rep = null;
if (repositoryUrl != null) {
resolver = new URLResolver();
((URLResolver)resolver).addArtifactPattern(
repositoryUrl + "/" + artifactPattern
);
((URLResolver)resolver).addIvyPattern(
repositoryUrl + "/" + ivyPattern
);
resolver.setName("default");
}
else if (repositoryDir != null) {
resolver = new FileSystemResolver();
((FileSystemResolver)resolver).addArtifactPattern(
repositoryDir + "/" + artifactPattern
);
((FileSystemResolver)resolver).addIvyPattern(
repositoryDir + "/" + ivyPattern
);
}
else if (ivyConfUrl != null) {
try {
ivy.configure(ivyConfUrl);
}
catch (IOException e) {
throw new BuildException(e);
}
catch (ParseException e) {
throw new BuildException(e);
}
}
else if (ivyConfFile != null) {
try {
ivy.configure(ivyConfFile);
}
catch (IOException e) {
throw new BuildException(e);
}
catch (ParseException e) {
throw new BuildException(e);
}
}
else {
resolver = new IvyRepResolver();
}
resolver.setName("default");
ivy.addResolver(resolver);
ivy.setDefaultResolver(resolver.getName());
ModuleId moduleId =
new ModuleId(org, module);
ModuleRevisionId revId =
new ModuleRevisionId(moduleId, rev);
ModuleDescriptor md =
new DefaultModuleDescriptor(revId, "integration", new Date());
Artifact artifact =
new MDArtifact(md, module, type, type);
ArtifactDownloadReport report =
ivy.download(artifact, null);
DownloadStatus status = report.getDownloadStatus();
if (status == DownloadStatus.FAILED) {
throw new BuildException("Could not resolve resource.");
}
String path = ivy.getArchivePathInCache(artifact);
File file = new File(ivy.getDefaultCache(), path);
File importFile = null;
if ("xml".equalsIgnoreCase(type)) {
importFile = file;