in src/main/java/org/apache/easyant/tasks/Import.java [72:135]
public void execute() {
ModuleRevisionId moduleRevisionId;
if (mrid != null) {
moduleRevisionId = ModuleRevisionId.parse(mrid);
} else if (organisation != null && module != null && revision != null) {
moduleRevisionId = ModuleRevisionId.newInstance(organisation, module, revision);
} else {
throw new BuildException(
"The module to import is not properly specified, you must set the mrid attribute or set organisation / module / revision attributes");
}
String moduleName = moduleRevisionId.toString();
if (!BuildConfigurationHelper.isBuildConfigurationActive(getBuildConfigurations(), getProject(), "module"
+ getModule())) {
log("no matching build configuration for module " + moduleName + " this module will be skipped ",
Project.MSG_DEBUG);
return;
}
// if no as attribute was given use module name
if (getAs() == null && "include".equals(getMode())) {
// when using mrid style
if (mrid != null) {
setAs(moduleRevisionId.getName());
// when using exploded style
} else if (getModule() != null) {
setAs(getModule());
}
}
// check if a property skip.${module} or skip.${as} is set
boolean toBeSkipped = getProject().getProperty("skip." + moduleName) != null
|| getProject().getProperty("skip." + getAs()) != null;
if (isMandatory() && toBeSkipped) {
log("Impossible to skip a mandatory module : " + moduleName, Project.MSG_WARN);
}
// a module can be skipped *only* if it is not mandatory
if (!isMandatory() && toBeSkipped) {
log(moduleName + " skipped !");
} else {
try {
DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(moduleRevisionId, getMainConf()
.split(","), true, isChanging());
IvySettings settings = getEasyAntIvyInstance().getSettings();
IvyContext.pushNewContext();
IvyContext.getContext().setIvy(getEasyAntIvyInstance());
// FIXME: If additionnal dependency are loaded or a superior version of a dependency is defined it works
// as expected
// But it doesn't work if you specify a revision lower to original one
md = EasyAntPluginBridge.computeModuleDescriptor(md, settings, dependencies, conflicts, excludes);
ResolveReport report = getEasyAntIvyInstance().getResolveEngine()
.resolve(md, configureResolveOptions());
importModule(moduleRevisionId, report);
IvyContext.popContext();
} catch (ParseException e) {
throw new BuildException("Can't parse module descriptor", e);
} catch (IOException e) {
throw new BuildException("Can't parse module descriptor", e);
}
}
}