use of org.apache.ivy.core.install.InstallOptions in project ant-ivy by apache.
the class IvyInstall method doExecute.
public void doExecute() throws BuildException {
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
if (organisation == null) {
throw new BuildException("no organisation provided for ivy publish task: " + "It can either be set explicitly via the attribute 'organisation' " + "or via 'ivy.organisation' property or a prior call to <resolve/>");
}
if (module == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
throw new BuildException("no module name provided for ivy publish task: " + "It can either be set explicitly via the attribute 'module' " + "or via 'ivy.module' property or a prior call to <resolve/>");
}
module = PatternMatcher.ANY_EXPRESSION;
}
if (revision == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
throw new BuildException("no module revision provided for ivy publish task: " + "It can either be set explicitly via the attribute 'revision' " + "or via 'ivy.revision' property or a prior call to <resolve/>");
}
revision = PatternMatcher.ANY_EXPRESSION;
}
if (branch == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
branch = settings.getDefaultBranch(ModuleId.newInstance(organisation, module));
} else {
branch = PatternMatcher.ANY_EXPRESSION;
}
}
if (from == null) {
throw new BuildException("no from resolver name: please provide it through parameter 'from'");
}
if (to == null) {
throw new BuildException("no to resolver name: please provide it through parameter 'to'");
}
ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, module, branch, revision);
ResolveReport report;
try {
report = ivy.install(mrid, from, to, new InstallOptions().setTransitive(transitive).setValidate(doValidate(settings)).setOverwrite(overwrite).setConfs(conf.split(",")).setArtifactFilter(FilterHelper.getArtifactTypeFilter(type)).setMatcherName(matcher).setInstallOriginalMetadata(installOriginalMetadata));
} catch (Exception e) {
throw new BuildException("impossible to install " + mrid + ": " + e, e);
}
if (report.hasError() && isHaltonfailure()) {
throw new BuildException("Problem happened while installing modules - see output for details");
}
}
Aggregations