// Is there any other parent properties?
ModuleRevisionId parentModRevID = ModuleRevisionId.newInstance(
domReader.getParentGroupId(), domReader.getParentArtifactId(),
domReader.getParentVersion());
ResolvedModuleRevision parentModule = parseOtherPom(ivySettings, parentModRevID);
if (parentModule != null) {
parentDescr = parentModule.getDescriptor();
} else {
throw new IOException("Impossible to load parent for " + res.getName() + "."
+ " Parent=" + parentModRevID);
}
if (parentDescr != null) {
Map parentPomProps = PomModuleDescriptorBuilder
.extractPomProperties(parentDescr.getExtraInfo());
for (Iterator iter = parentPomProps.entrySet().iterator(); iter.hasNext();) {
Map.Entry prop = (Map.Entry) iter.next();
domReader.setProperty((String) prop.getKey(), (String) prop.getValue());
}
}
}
String groupId = domReader.getGroupId();
String artifactId = domReader.getArtifactId();
String version = domReader.getVersion();
mdBuilder.setModuleRevId(groupId, artifactId, version);
mdBuilder.setHomePage(domReader.getHomePage());
mdBuilder.setDescription(domReader.getDescription());
mdBuilder.setLicenses(domReader.getLicenses());
ModuleRevisionId relocation = domReader.getRelocation();
if (relocation != null) {
if (groupId != null && artifactId != null
&& artifactId.equals(relocation.getName())
&& groupId.equals(relocation.getOrganisation())) {
Message.error("Relocation to an other version number not supported in ivy : "
+ mdBuilder.getModuleDescriptor().getModuleRevisionId()
+ " relocated to " + relocation
+ ". Please update your dependency to directly use the right version.");
Message.warn("Resolution will only pick dependencies of the relocated element."
+ " Artefact and other metadata will be ignored.");
ResolvedModuleRevision relocatedModule = parseOtherPom(ivySettings, relocation);
if (relocatedModule == null) {
throw new ParseException("impossible to load module " + relocation
+ " to which "
+ mdBuilder.getModuleDescriptor().getModuleRevisionId()
+ " has been relocated", 0);
}
DependencyDescriptor[] dds = relocatedModule.getDescriptor().getDependencies();
for (int i = 0; i < dds.length; i++) {
mdBuilder.addDependency(dds[i]);
}
} else {
Message.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
+ " is relocated to " + relocation
+ ". Please update your dependencies.");
Message.verbose("Relocated module will be considered as a dependency");
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
mdBuilder.getModuleDescriptor(), relocation, true, false, true);
/* Map all public dependencies */
Configuration[] m2Confs = PomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
for (int i = 0; i < m2Confs.length; i++) {
if (Visibility.PUBLIC.equals(m2Confs[i].getVisibility())) {
dd.addDependencyConfiguration(m2Confs[i].getName(),
m2Confs[i].getName());
}
}
mdBuilder.addDependency(dd);
}
} else {
domReader.setProperty("project.groupId", groupId);
domReader.setProperty("pom.groupId", groupId);
domReader.setProperty("groupId", groupId);
domReader.setProperty("project.artifactId", artifactId);
domReader.setProperty("pom.artifactId", artifactId);
domReader.setProperty("artifactId", artifactId);
domReader.setProperty("project.version", version);
domReader.setProperty("pom.version", version);
domReader.setProperty("version", version);
if (parentDescr != null) {
mdBuilder.addExtraInfos(parentDescr.getExtraInfo());
// add dependency management info from parent
List depMgt = PomModuleDescriptorBuilder.getDependencyManagements(parentDescr);
for (Iterator it = depMgt.iterator(); it.hasNext();) {
PomDependencyMgt dep = (PomDependencyMgt) it.next();
if (dep instanceof PomDependencyMgtElement) {
dep = domReader.new PomDependencyMgtElement(
(PomDependencyMgtElement) dep);
}
mdBuilder.addDependencyMgt(dep);
}
// add plugins from parent
List /* <PomDependencyMgt> */plugins = PomModuleDescriptorBuilder
.getPlugins(parentDescr);
for (Iterator it = plugins.iterator(); it.hasNext();) {
mdBuilder.addPlugin((PomDependencyMgt) it.next());
}
}
for (Iterator it = domReader.getDependencyMgt().iterator(); it.hasNext();) {
PomDependencyMgt dep = (PomDependencyMgt) it.next();
if ("import".equals(dep.getScope())) {
ModuleRevisionId importModRevID = ModuleRevisionId.newInstance(
dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
ResolvedModuleRevision importModule = parseOtherPom(ivySettings,
importModRevID);
if (importModule != null) {
ModuleDescriptor importDescr = importModule.getDescriptor();
// add dependency management info from imported module
List depMgt = PomModuleDescriptorBuilder
.getDependencyManagements(importDescr);
for (Iterator it2 = depMgt.iterator(); it2.hasNext();) {