setTaskName("osgi-undeploy");
setDescription("Undeploys a bundle from the bundle repository");
}
public void execute() {
Deployer deployer = new Deployer(repository);
deployer.setVerbose(verbose);
version = version.trim();
range = range.trim();
if (version.length() > 0 && range.length() > 0) {
throw new BuildException("Only version or range can be set not both");
}
try {
if (version.length() > 0) {
Version bundleVersion = Version.parseVersion(version);
deployer.undeploy(bundleName, bundleVersion, true);
} else {
VersionRange bundleVersionRange = VersionRange.parseVersionRange(range);
deployer.undeploy(bundleName, bundleVersionRange, true);
}
log(deployer.getLogMessages());
} catch (IOException e) {
throw new BuildException("Undeployment of bundle failed: " + e.getMessage());
} catch (Throwable t) {
throw new BuildException(t.getMessage());
}