[IVY-1558] support dependencies in active profiles

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/8ff6e5a9
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/8ff6e5a9
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/8ff6e5a9

Branch: refs/heads/xooki2asciidoc
Commit: 8ff6e5a90f725ce7acd56f2c919221d8c179270f
Parents: 539e1ee
Author: Matt Benson <[email protected]>
Authored: Fri Apr 21 09:15:07 2017 -0500
Committer: Matt Benson <[email protected]>
Committed: Fri Apr 21 09:15:07 2017 -0500

----------------------------------------------------------------------
 .../parser/m2/PomModuleDescriptorBuilder.java   |  13 +-
 .../parser/m2/PomModuleDescriptorParser.java    | 178 ++++++++--------
 .../apache/ivy/plugins/parser/m2/PomReader.java | 205 ++++++++++++++-----
 .../m2/PomModuleDescriptorParserTest.java       |  92 ++++++++-
 .../apache/ivy/plugins/parser/m2/depmgt/bom.pom |  52 +++++
 .../ivy/plugins/parser/m2/depmgt/child.pom      |  36 ++++
 .../ivy/plugins/parser/m2/depmgt/grandchild.pom |  36 ++++
 .../ivy/plugins/parser/m2/depmgt/parent.pom     |  38 ++++
 .../parser/m2/depmgt/profile-parent-child.pom   |  36 ++++
 .../plugins/parser/m2/depmgt/profile-parent.pom |  46 +++++
 10 files changed, 587 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
index 5445f0c..63ad87f 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
@@ -27,7 +27,6 @@ import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.cache.ArtifactOrigin;
@@ -284,7 +283,7 @@ public class PomModuleDescriptorBuilder {
         ModuleRevisionId moduleRevId = 
ModuleRevisionId.newInstance(dep.getGroupId(),
             dep.getArtifactId(), version);
 
-        // Some POMs depend on theirselfves, don't add this dependency: Ivy 
doesn't allow this!
+        // Some POMs depend on themselves; Ivy doesn't allow this. Don't add 
this dependency!
         // Example: 
https://repo1.maven.org/maven2/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
         ModuleRevisionId mRevId = ivyModuleDescriptor.getModuleRevisionId();
         if ((mRevId != null) && 
mRevId.getModuleId().equals(moduleRevId.getModuleId())) {
@@ -533,7 +532,7 @@ public class PomModuleDescriptorBuilder {
     public static Map<ModuleId, String> 
getDependencyManagementMap(ModuleDescriptor md) {
         Map<ModuleId, String> ret = new LinkedHashMap<ModuleId, String>();
         if (md instanceof PomModuleDescriptor) {
-            for (Entry<ModuleId, PomDependencyMgt> e : ((PomModuleDescriptor) 
md)
+            for (Map.Entry<ModuleId, PomDependencyMgt> e : 
((PomModuleDescriptor) md)
                     .getDependencyManagementMap().entrySet()) {
                 PomDependencyMgt dependencyMgt = e.getValue();
                 ret.put(e.getKey(), dependencyMgt.getVersion());
@@ -564,7 +563,7 @@ public class PomModuleDescriptorBuilder {
         } else {
             for (ExtraInfoHolder extraInfoHolder : md.getExtraInfos()) {
                 String key = extraInfoHolder.getName();
-                if ((key).startsWith(DEPENDENCY_MANAGEMENT)) {
+                if (key.startsWith(DEPENDENCY_MANAGEMENT)) {
                     String[] parts = key.split(EXTRA_INFO_DELIMITER);
                     if (parts.length != DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT) 
{
                         Message.warn("what seem to be a dependency management 
extra info "
@@ -592,7 +591,7 @@ public class PomModuleDescriptorBuilder {
 
     @Deprecated
     public void addExtraInfos(Map<String, String> extraAttributes) {
-        for (Entry<String, String> entry : extraAttributes.entrySet()) {
+        for (Map.Entry<String, String> entry : extraAttributes.entrySet()) {
             addExtraInfo(entry.getKey(), entry.getValue());
         }
     }
@@ -625,7 +624,7 @@ public class PomModuleDescriptorBuilder {
     @Deprecated
     public static Map<String, String> extractPomProperties(Map<String, String> 
extraInfo) {
         Map<String, String> r = new HashMap<String, String>();
-        for (Entry<String, String> extraInfoEntry : extraInfo.entrySet()) {
+        for (Map.Entry<String, String> extraInfoEntry : extraInfo.entrySet()) {
             if (extraInfoEntry.getKey().startsWith(PROPERTIES)) {
                 String prop = extraInfoEntry.getKey().substring(
                     PROPERTIES.length() + EXTRA_INFO_DELIMITER.length());
@@ -706,7 +705,7 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static class PomModuleDescriptor extends DefaultModuleDescriptor {
-        private final Map<ModuleId, PomDependencyMgt> dependencyManagementMap 
= new HashMap<ModuleId, PomDependencyMgt>();
+        private final Map<ModuleId, PomDependencyMgt> dependencyManagementMap 
= new LinkedHashMap<ModuleId, PomDependencyMgt>();
 
         public PomModuleDescriptor(ModuleDescriptorParser parser, Resource 
res) {
             super(parser, res);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
index f2d3cfc..c7d82ba 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
@@ -23,7 +23,6 @@ import java.io.InputStream;
 import java.net.URL;
 import java.text.ParseException;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -48,6 +47,8 @@ import org.apache.ivy.plugins.parser.ParserSettings;
 import 
org.apache.ivy.plugins.parser.m2.PomModuleDescriptorBuilder.PomDependencyDescriptor;
 import org.apache.ivy.plugins.parser.m2.PomReader.PomDependencyData;
 import org.apache.ivy.plugins.parser.m2.PomReader.PomDependencyMgtElement;
+import org.apache.ivy.plugins.parser.m2.PomReader.PomPluginElement;
+import org.apache.ivy.plugins.parser.m2.PomReader.PomProfileElement;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.ivy.plugins.repository.Resource;
 import org.apache.ivy.plugins.repository.url.URLResource;
@@ -122,11 +123,10 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
             domReader.setProperty("project.parent.version", 
domReader.getParentVersion());
             domReader.setProperty("project.parent.groupId", 
domReader.getParentGroupId());
 
-            Map pomProperties = domReader.getPomProperties();
-            for (Iterator iter = pomProperties.entrySet().iterator(); 
iter.hasNext();) {
-                Map.Entry prop = (Map.Entry) iter.next();
-                domReader.setProperty((String) prop.getKey(), (String) 
prop.getValue());
-                mdBuilder.addProperty((String) prop.getKey(), (String) 
prop.getValue());
+            Map<String, String> pomProperties = domReader.getPomProperties();
+            for (Map.Entry<String, String> prop : pomProperties.entrySet()) {
+                domReader.setProperty(prop.getKey(), prop.getValue());
+                mdBuilder.addProperty(prop.getKey(), prop.getValue());
             }
 
             ModuleDescriptor parentDescr = null;
@@ -137,18 +137,16 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                     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 (parentModule == null) {
+                    throw new IOException("Impossible to load parent for " + 
res.getName()
+                            + ". Parent=" + parentModRevID);
                 }
+                parentDescr = parentModule.getDescriptor();
                 if (parentDescr != null) {
-                    Map parentPomProps = PomModuleDescriptorBuilder
+                    Map<String, String> parentPomProps = 
PomModuleDescriptorBuilder
                             .extractPomProperties(parentDescr.getExtraInfos());
-                    for (Iterator iter = parentPomProps.entrySet().iterator(); 
iter.hasNext();) {
-                        Map.Entry prop = (Map.Entry) iter.next();
-                        domReader.setProperty((String) prop.getKey(), (String) 
prop.getValue());
+                    for (Map.Entry<String, String> prop : 
parentPomProps.entrySet()) {
+                        domReader.setProperty(prop.getKey(), prop.getValue());
                     }
                 }
             }
@@ -164,17 +162,14 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
             final License[] licenses = domReader.getLicenses();
             if (licenses != null && licenses.length > 0) {
                 mdBuilder.setLicenses(licenses);
-            } else {
-                if (parentDescr != null) {
-                    mdBuilder.setLicenses(parentDescr.getLicenses());
-                }
+            } else if (parentDescr != null) {
+                mdBuilder.setLicenses(parentDescr.getLicenses());
             }
 
             ModuleRevisionId relocation = domReader.getRelocation();
 
             if (relocation != null) {
-                if (groupId != null && artifactId != null
-                        && artifactId.equals(relocation.getName())
+                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()
@@ -184,28 +179,28 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                             + "  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);
+                        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]);
+                    for (DependencyDescriptor dd : 
relocatedModule.getDescriptor()
+                            .getDependencies()) {
+                        mdBuilder.addDependency(dd);
                     }
                 } else {
-                    
Message.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
-                            + " is relocated to " + relocation
-                            + ". Please update your dependencies.");
+                    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());
+                    for (Configuration m2Conf : m2Confs) {
+                        if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
+                            dd.addDependencyConfiguration(m2Conf.getName(), 
m2Conf.getName());
                         }
                     }
                     mdBuilder.addDependency(dd);
@@ -225,9 +220,9 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                     mdBuilder.addExtraInfos(parentDescr.getExtraInfos());
 
                     // add dependency management info from parent
-                    List depMgt = 
PomModuleDescriptorBuilder.getDependencyManagements(parentDescr);
-                    for (Iterator it = depMgt.iterator(); it.hasNext();) {
-                        PomDependencyMgt dep = (PomDependencyMgt) it.next();
+                    List<PomDependencyMgt> depMgt = PomModuleDescriptorBuilder
+                            .getDependencyManagements(parentDescr);
+                    for (PomDependencyMgt dep : depMgt) {
                         if (dep instanceof PomDependencyMgtElement) {
                             dep = domReader.new PomDependencyMgtElement(
                                     (PomDependencyMgtElement) dep);
@@ -236,52 +231,40 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                     }
 
                     // add plugins from parent
-                    List /* <PomDependencyMgt> */plugins = 
PomModuleDescriptorBuilder
-                            .getPlugins(parentDescr);
-                    for (Iterator it = plugins.iterator(); it.hasNext();) {
-                        mdBuilder.addPlugin((PomDependencyMgt) it.next());
+                    for (PomDependencyMgt pomDependencyMgt : 
PomModuleDescriptorBuilder
+                            .getPlugins(parentDescr)) {
+                        mdBuilder.addPlugin((PomDependencyMgt) 
pomDependencyMgt);
                     }
                 }
 
-                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();) {
-                                PomDependencyMgt importedDepMgt = 
(PomDependencyMgt) it2.next();
-                                mdBuilder.addDependencyMgt(new 
DefaultPomDependencyMgt(
-                                        importedDepMgt.getGroupId(),
-                                        importedDepMgt.getArtifactId(),
-                                        importedDepMgt.getVersion(), 
importedDepMgt.getScope(),
-                                        importedDepMgt.getExcludedModules()));
-                            }
-                        } else {
-                            throw new IOException("Impossible to import module 
for "
-                                    + res.getName() + "." + " Import=" + 
importModRevID);
-                        }
+                for (PomDependencyMgt dep : domReader.getDependencyMgt()) {
+                    addTo(mdBuilder, dep, ivySettings);
+                }
+                for (PomDependencyData dep : domReader.getDependencies()) {
+                    mdBuilder.addDependency(res, dep);
+                }
 
-                    } else {
-                        mdBuilder.addDependencyMgt(dep);
-                    }
+                for (PomPluginElement plugin : domReader.getPlugins()) {
+                    mdBuilder.addPlugin(plugin);
                 }
 
-                for (Iterator it = domReader.getDependencies().iterator(); 
it.hasNext();) {
-                    PomReader.PomDependencyData dep = 
(PomReader.PomDependencyData) it.next();
-                    mdBuilder.addDependency(res, dep);
+                // consult active profiles:
+                for (PomProfileElement profile : domReader.getProfiles()) {
+                    if (profile.isActive()) {
+                        for (PomDependencyMgt dep : 
profile.getDependencyMgt()) {
+                            addTo(mdBuilder, dep, ivySettings);
+                        }
+                        for (PomDependencyData dep : 
profile.getDependencies()) {
+                            mdBuilder.addDependency(res, dep);
+                        }
+                        for (PomPluginElement plugin : profile.getPlugins()) {
+                            mdBuilder.addPlugin(plugin);
+                        }
+                    }
                 }
 
                 if (parentDescr != null) {
-                    for (int i = 0; i < parentDescr.getDependencies().length; 
i++) {
-                        DependencyDescriptor descriptor = 
parentDescr.getDependencies()[i];
+                    for (DependencyDescriptor descriptor : 
parentDescr.getDependencies()) {
                         if (descriptor instanceof PomDependencyDescriptor) {
                             PomDependencyData parentDep = 
((PomDependencyDescriptor) descriptor)
                                     .getPomDependencyData();
@@ -293,11 +276,6 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                     }
                 }
 
-                for (Iterator it = domReader.getPlugins().iterator(); 
it.hasNext();) {
-                    PomReader.PomPluginElement plugin = 
(PomReader.PomPluginElement) it.next();
-                    mdBuilder.addPlugin(plugin);
-                }
-
                 mdBuilder.addMainArtifact(artifactId, 
domReader.getPackaging());
 
                 addSourcesAndJavadocArtifactsIfPresent(mdBuilder, ivySettings);
@@ -309,6 +287,33 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
         return mdBuilder.getModuleDescriptor();
     }
 
+    private void addTo(PomModuleDescriptorBuilder mdBuilder, PomDependencyMgt 
dep,
+            ParserSettings ivySettings) throws ParseException, IOException {
+        if ("import".equals(dep.getScope())) {
+            ModuleRevisionId importModRevID = 
ModuleRevisionId.newInstance(dep.getGroupId(),
+                dep.getArtifactId(), dep.getVersion());
+            ResolvedModuleRevision importModule = parseOtherPom(ivySettings, 
importModRevID);
+            if (importModule == null) {
+                throw new IOException("Impossible to import module for "
+                        + 
mdBuilder.getModuleDescriptor().getResource().getName() + ". Import="
+                        + importModRevID);
+            }
+            ModuleDescriptor importDescr = importModule.getDescriptor();
+
+            // add dependency management info from imported module
+            List<PomDependencyMgt> depMgt = PomModuleDescriptorBuilder
+                    .getDependencyManagements(importDescr);
+            for (PomDependencyMgt importedDepMgt : depMgt) {
+                mdBuilder.addDependencyMgt(new 
DefaultPomDependencyMgt(importedDepMgt.getGroupId(),
+                        importedDepMgt.getArtifactId(), 
importedDepMgt.getVersion(),
+                        importedDepMgt.getScope(), 
importedDepMgt.getExcludedModules()));
+            }
+        } else {
+            mdBuilder.addDependencyMgt(dep);
+        }
+
+    }
+
     private void 
addSourcesAndJavadocArtifactsIfPresent(PomModuleDescriptorBuilder mdBuilder,
             ParserSettings ivySettings) {
         if (mdBuilder.getMainArtifact() == null) {
@@ -316,8 +321,10 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
             return;
         }
 
-        boolean sourcesLookup = 
!"false".equals(ivySettings.getVariable("ivy.maven.lookup.sources"));
-        boolean javadocLookup = 
!"false".equals(ivySettings.getVariable("ivy.maven.lookup.javadoc"));
+        boolean sourcesLookup = !"false"
+                .equals(ivySettings.getVariable("ivy.maven.lookup.sources"));
+        boolean javadocLookup = !"false"
+                .equals(ivySettings.getVariable("ivy.maven.lookup.javadoc"));
         if (!sourcesLookup && !javadocLookup) {
             Message.debug("Sources and javadocs lookup disabled");
             return;
@@ -328,8 +335,8 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
         DependencyResolver resolver = ivySettings.getResolver(mrid);
 
         if (resolver == null) {
-            Message.debug("no resolver found for " + mrid
-                    + ": no source or javadoc artifact lookup");
+            Message.debug(
+                "no resolver found for " + mrid + ": no source or javadoc 
artifact lookup");
         } else {
             ArtifactOrigin mainArtifact = 
resolver.locate(mdBuilder.getMainArtifact());
 
@@ -359,7 +366,8 @@ public final class PomModuleDescriptorParser implements 
ModuleDescriptorParser {
                 }
 
                 if (javadocLookup) {
-                    ArtifactOrigin javadocArtifact = 
resolver.locate(mdBuilder.getJavadocArtifact());
+                    ArtifactOrigin javadocArtifact = resolver
+                            .locate(mdBuilder.getJavadocArtifact());
                     if (!ArtifactOrigin.isUnknown(javadocArtifact)
                             && 
!javadocArtifact.getLocation().equals(mainArtifactLocation)) {
                         Message.debug("javadoc artifact found for " + mrid);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
index 1d25d48..bfefe7c 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
@@ -52,6 +52,8 @@ import org.xml.sax.SAXParseException;
  */
 public class PomReader {
 
+    private static final String PROFILES_ELEMENT = "profiles";
+
     private static final String PACKAGING = "packaging";
 
     private static final String DEPENDENCY = "dependency";
@@ -106,6 +108,8 @@ public class PomReader {
 
     private static final String TYPE = "type";
 
+    private static final String PROFILE = "profile";
+
     private HashMap<String, String> properties = new HashMap<String, String>();
 
     private final Element projectElement;
@@ -113,8 +117,8 @@ public class PomReader {
     private final Element parentElement;
 
     public PomReader(URL descriptorURL, Resource res) throws IOException, 
SAXException {
-        InputStream stream = new 
AddDTDFilterInputStream(URLHandlerRegistry.getDefault()
-                .openStream(descriptorURL));
+        InputStream stream = new AddDTDFilterInputStream(
+                URLHandlerRegistry.getDefault().openStream(descriptorURL));
         InputSource source = new InputSource(stream);
         source.setSystemId(XMLHelper.toSystemId(descriptorURL));
         try {
@@ -122,8 +126,8 @@ public class PomReader {
                 public InputSource resolveEntity(String publicId, String 
systemId)
                         throws SAXException, IOException {
                     if ((systemId != null) && 
systemId.endsWith("m2-entities.ent")) {
-                        return new InputSource(PomReader.class
-                                .getResourceAsStream("m2-entities.ent"));
+                        return new InputSource(
+                                
PomReader.class.getResourceAsStream("m2-entities.ent"));
                     }
                     return null;
                 }
@@ -276,36 +280,62 @@ public class PomReader {
     }
 
     public List<PomDependencyData> getDependencies() {
-        Element dependenciesElement = getFirstChildElement(projectElement, 
DEPENDENCIES);
-        LinkedList<PomDependencyData> dependencies = new 
LinkedList<PomDependencyData>();
-        if (dependenciesElement != null) {
-            NodeList childs = dependenciesElement.getChildNodes();
-            for (int i = 0; i < childs.getLength(); i++) {
-                Node node = childs.item(i);
-                if (node instanceof Element && 
DEPENDENCY.equals(node.getNodeName())) {
-                    dependencies.add(new PomDependencyData((Element) node));
-                }
+        return getDependencies(projectElement);
+    }
+
+    private List<PomDependencyData> getDependencies(Element parent) {
+        Element dependenciesElement = getFirstChildElement(parent, 
DEPENDENCIES);
+        if (dependenciesElement == null) {
+            return Collections.emptyList();
+        }
+        List<PomDependencyData> dependencies = new 
LinkedList<PomDependencyData>();
+        NodeList children = dependenciesElement.getChildNodes();
+        for (int i = 0, sz = children.getLength(); i < sz; i++) {
+            Node node = children.item(i);
+            if (node instanceof Element && 
DEPENDENCY.equals(node.getNodeName())) {
+                dependencies.add(new PomDependencyData((Element) node));
             }
         }
         return dependencies;
     }
 
     public List<PomDependencyMgt> getDependencyMgt() {
-        Element dependenciesElement = getFirstChildElement(projectElement, 
DEPENDENCY_MGT);
-        dependenciesElement = getFirstChildElement(dependenciesElement, 
DEPENDENCIES);
-        LinkedList<PomDependencyMgt> dependencies = new 
LinkedList<PomDependencyMgt>();
-        if (dependenciesElement != null) {
-            NodeList childs = dependenciesElement.getChildNodes();
-            for (int i = 0; i < childs.getLength(); i++) {
-                Node node = childs.item(i);
-                if (node instanceof Element && 
DEPENDENCY.equals(node.getNodeName())) {
-                    dependencies.add(new PomDependencyMgtElement((Element) 
node));
-                }
+        return getDependencyMgt(projectElement);
+    }
+
+    private List<PomDependencyMgt> getDependencyMgt(Element parent) {
+        Element dependenciesElement = getFirstChildElement(
+            getFirstChildElement(parent, DEPENDENCY_MGT), DEPENDENCIES);
+        if (dependenciesElement == null) {
+            return Collections.emptyList();
+        }
+        List<PomDependencyMgt> dependencies = new 
LinkedList<PomDependencyMgt>();
+        NodeList children = dependenciesElement.getChildNodes();
+        for (int i = 0, sz = children.getLength(); i < sz; i++) {
+            Node node = children.item(i);
+            if (node instanceof Element && 
DEPENDENCY.equals(node.getNodeName())) {
+                dependencies.add(new PomDependencyMgtElement((Element) node));
             }
         }
         return dependencies;
     }
 
+    public List<PomProfileElement> getProfiles() {
+        Element profilesElement = getFirstChildElement(projectElement, 
PROFILES_ELEMENT);
+        if (profilesElement == null) {
+            return Collections.emptyList();
+        }
+        List<PomProfileElement> result = new 
LinkedList<PomReader.PomProfileElement>();
+        NodeList children = profilesElement.getChildNodes();
+        for (int i = 0, sz = children.getLength(); i < sz; i++) {
+            Node node = children.item(i);
+            if (node instanceof Element && PROFILE.equals(node.getNodeName())) 
{
+                result.add(new PomProfileElement((Element) node));
+            }
+        }
+        return result;
+    }
+
     public class PomDependencyMgtElement implements PomDependencyMgt {
         private final Element depElement;
 
@@ -319,7 +349,6 @@ public class PomReader {
 
         /*
          * (non-Javadoc)
-         * 
          * @see org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getGroupId()
          */
         public String getGroupId() {
@@ -329,7 +358,6 @@ public class PomReader {
 
         /*
          * (non-Javadoc)
-         * 
          * @see 
org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getArtifaceId()
          */
         public String getArtifactId() {
@@ -339,7 +367,6 @@ public class PomReader {
 
         /*
          * (non-Javadoc)
-         * 
          * @see org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getVersion()
          */
         public String getVersion() {
@@ -354,17 +381,18 @@ public class PomReader {
 
         public List<ModuleId> getExcludedModules() {
             Element exclusionsElement = getFirstChildElement(depElement, 
EXCLUSIONS);
+            if (exclusionsElement == null) {
+                return Collections.emptyList();
+            }
             LinkedList<ModuleId> exclusions = new LinkedList<ModuleId>();
-            if (exclusionsElement != null) {
-                NodeList childs = exclusionsElement.getChildNodes();
-                for (int i = 0; i < childs.getLength(); i++) {
-                    Node node = childs.item(i);
-                    if (node instanceof Element && 
EXCLUSION.equals(node.getNodeName())) {
-                        String groupId = getFirstChildText((Element) node, 
GROUP_ID);
-                        String artifactId = getFirstChildText((Element) node, 
ARTIFACT_ID);
-                        if ((groupId != null) && (artifactId != null)) {
-                            exclusions.add(ModuleId.newInstance(groupId, 
artifactId));
-                        }
+            NodeList children = exclusionsElement.getChildNodes();
+            for (int i = 0, sz = children.getLength(); i < sz; i++) {
+                Node node = children.item(i);
+                if (node instanceof Element && 
EXCLUSION.equals(node.getNodeName())) {
+                    String groupId = getFirstChildText((Element) node, 
GROUP_ID);
+                    String artifactId = getFirstChildText((Element) node, 
ARTIFACT_ID);
+                    if ((groupId != null) && (artifactId != null)) {
+                        exclusions.add(ModuleId.newInstance(groupId, 
artifactId));
                     }
                 }
             }
@@ -373,21 +401,22 @@ public class PomReader {
     }
 
     public List<PomPluginElement> getPlugins() {
-        LinkedList<PomPluginElement> plugins = new 
LinkedList<PomPluginElement>();
-
-        Element buildElement = getFirstChildElement(projectElement, "build");
-        if (buildElement == null) {
-            return plugins;
-        }
+        return getPlugins(projectElement);
+    }
 
+    private List<PomPluginElement> getPlugins(Element parent) {
+        Element buildElement = getFirstChildElement(parent, "build");
         Element pluginsElement = getFirstChildElement(buildElement, PLUGINS);
-        if (pluginsElement != null) {
-            NodeList childs = pluginsElement.getChildNodes();
-            for (int i = 0; i < childs.getLength(); i++) {
-                Node node = childs.item(i);
-                if (node instanceof Element && 
PLUGIN.equals(node.getNodeName())) {
-                    plugins.add(new PomPluginElement((Element) node));
-                }
+
+        if (pluginsElement == null) {
+            return Collections.emptyList();
+        }
+        NodeList children = pluginsElement.getChildNodes();
+        List<PomPluginElement> plugins = new LinkedList<PomPluginElement>();
+        for (int i = 0; i < children.getLength(); i++) {
+            Node node = children.item(i);
+            if (node instanceof Element && PLUGIN.equals(node.getNodeName())) {
+                plugins.add(new PomPluginElement((Element) node));
             }
         }
         return plugins;
@@ -453,8 +482,80 @@ public class PomReader {
         }
 
         public boolean isOptional() {
-            Element e = getFirstChildElement(depElement, OPTIONAL);
-            return (e != null) && "true".equalsIgnoreCase(getTextContent(e));
+            return Boolean.parseBoolean(getFirstChildText(depElement, 
OPTIONAL));
+        }
+
+    }
+
+    public class PomProfileElement {
+
+        private static final String VALUE = "value";
+
+        private static final String NAME = "name";
+
+        private static final String PROPERTY = "property";
+
+        private static final String ID_ELEMENT = "id";
+
+        private static final String ACTIVATION_ELEMENT = "activation";
+
+        private static final String ACTIVE_BY_DEFAULT_ELEMENT = 
"activeByDefault";
+
+        private final Element profileElement;
+
+        PomProfileElement(Element profileElement) {
+            this.profileElement = profileElement;
+        }
+
+        public String getId() {
+            return getFirstChildText(profileElement, ID_ELEMENT);
+        }
+
+        public boolean isActive() {
+            return isActiveByDefault() || isActivatedByProperty();
+        }
+
+        public boolean isActiveByDefault() {
+            Element activation = getFirstChildElement(profileElement, 
ACTIVATION_ELEMENT);
+            return Boolean.parseBoolean(getFirstChildText(activation, 
ACTIVE_BY_DEFAULT_ELEMENT));
+        }
+
+        public boolean isActivatedByProperty() {
+            Element activation = getFirstChildElement(profileElement, 
ACTIVATION_ELEMENT);
+            Element propertyActivation = getFirstChildElement(activation, 
PROPERTY);
+            String propertyName = getFirstChildText(propertyActivation, NAME);
+            if (propertyName == null || "".equals(propertyName)) {
+                return false;
+            }
+            boolean negate = propertyName.charAt(0) == '!';
+            if (negate) {
+                propertyName = propertyName.substring(1);
+            }
+            if ("".equals(propertyName)) {
+                return false;
+            }
+            String propertyValue = getFirstChildText(propertyActivation, 
VALUE);
+            
+            Map<String, String> pomProperties = 
PomReader.this.getPomProperties();
+            boolean matched;
+            if (propertyValue == null || "".equals(propertyValue)) {
+                matched = pomProperties.containsKey(propertyName);
+            } else {
+                matched = 
propertyValue.equals(pomProperties.get(propertyName));
+            }
+            return matched ^ negate;
+        }
+
+        public List<PomDependencyData> getDependencies() {
+            return PomReader.this.getDependencies(profileElement);
+        }
+
+        public List<PomDependencyMgt> getDependencyMgt() {
+            return PomReader.this.getDependencyMgt(profileElement);
+        }
+
+        public List<PomPluginElement> getPlugins() {
+            return PomReader.this.getPlugins(profileElement);
         }
 
     }
@@ -483,7 +584,7 @@ public class PomReader {
     }
 
     private static String getTextContent(Element element) {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
 
         NodeList childNodes = element.getChildNodes();
         for (int i = 0; i < childNodes.getLength(); i++) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java 
b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
index 6f60ace..02e1736 100644
--- 
a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
+++ 
b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
@@ -340,7 +340,7 @@ public class PomModuleDescriptorParserTest extends 
AbstractModuleDescriptorParse
     }
 
     // IVY-392
-    public void testDependenciesWithProfile() throws Exception {
+    public void testDependenciesWithInactiveProfile() throws Exception {
         ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-dependencies-with-profile.pom"), 
false);
         assertNotNull(md);
@@ -888,6 +888,96 @@ public class PomModuleDescriptorParserTest extends 
AbstractModuleDescriptorParse
         assertEquals("jar", artifact[0].getType());
     }
 
+    public void testParentBomImport() throws ParseException, IOException {
+        settings.setDictatorResolver(new MockResolver() {
+            public ResolvedModuleRevision getDependency(DependencyDescriptor 
dd, ResolveData data)
+                    throws ParseException {
+                try {
+                    ModuleDescriptor moduleDescriptor = 
PomModuleDescriptorParser.getInstance()
+                            .parseDescriptor(settings,
+                                getClass().getResource(
+                                    String.format("depmgt/%s.pom", 
dd.getDependencyId().getName())),
+                                false);
+                    return new ResolvedModuleRevision(null, null, 
moduleDescriptor, null);
+                } catch (IOException e) {
+                    throw new AssertionError(e);
+                }
+            }
+        });
+        ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("depmgt/child.pom"), false);
+        assertNotNull(md);
+        assertEquals("1.0", md.getRevision());
+
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertNotNull(dds);
+        assertEquals(1, dds.length);
+
+        assertEquals(ModuleRevisionId.newInstance("commons-logging", 
"commons-logging", "1.0.4"),
+            dds[0].getDependencyRevisionId());
+    }
+
+    public void testGrandparentBomImport() throws ParseException, IOException {
+        settings.setDictatorResolver(new MockResolver() {
+            public ResolvedModuleRevision getDependency(DependencyDescriptor 
dd, ResolveData data)
+                    throws ParseException {
+                try {
+                    ModuleDescriptor moduleDescriptor = 
PomModuleDescriptorParser.getInstance()
+                            .parseDescriptor(settings,
+                                getClass().getResource(
+                                    String.format("depmgt/%s.pom", 
dd.getDependencyId().getName())),
+                                false);
+                    return new ResolvedModuleRevision(null, null, 
moduleDescriptor, null);
+                } catch (IOException e) {
+                    throw new AssertionError(e);
+                }
+            }
+        });
+        ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("depmgt/grandchild.pom"), false);
+        assertNotNull(md);
+        assertEquals("1.0", md.getRevision());
+
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertNotNull(dds);
+        assertEquals(2, dds.length);
+
+        assertEquals(
+            ModuleRevisionId.newInstance("commons-collection", 
"commons-collection", "1.0.5"),
+            dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("commons-logging", 
"commons-logging", "1.0.4"),
+            dds[1].getDependencyRevisionId());
+    }
+
+    public void testParentProfileBomImport() throws ParseException, 
IOException {
+        settings.setDictatorResolver(new MockResolver() {
+            public ResolvedModuleRevision getDependency(DependencyDescriptor 
dd, ResolveData data)
+                    throws ParseException {
+                try {
+                    ModuleDescriptor moduleDescriptor = 
PomModuleDescriptorParser.getInstance()
+                            .parseDescriptor(settings,
+                                getClass().getResource(
+                                    String.format("depmgt/%s.pom", 
dd.getDependencyId().getName())),
+                                false);
+                    return new ResolvedModuleRevision(null, null, 
moduleDescriptor, null);
+                } catch (IOException e) {
+                    throw new AssertionError(e);
+                }
+            }
+        });
+        ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("depmgt/profile-parent-child.pom"), false);
+        assertNotNull(md);
+        assertEquals("1.0", md.getRevision());
+
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertNotNull(dds);
+        assertEquals(1, dds.length);
+
+        assertEquals(ModuleRevisionId.newInstance("commons-logging", 
"commons-logging", "1.0.4"),
+            dds[0].getDependencyRevisionId());
+    }
+
     private IvySettings createIvySettingsForParentLicenseTesting(final String 
parentPomFileName, final String parentOrgName,
                                                                  final String 
parentModuleName) throws Exception {
         final URL parentPomURL = 
this.getClass().getResource(parentPomFileName);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/bom.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/bom.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/bom.pom
new file mode 100644
index 0000000..99d35a9
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/bom.pom
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache</groupId>
+  <artifactId>bom</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>1.0.4</version>
+      </dependency>
+      <dependency>
+        <groupId>commons-collection</groupId>
+        <artifactId>commons-collection</artifactId>
+        <version>1.0.5</version>
+        <exclusions>
+          <exclusion>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>javax.jms</groupId>
+            <artifactId>jms</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/child.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/child.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/child.pom
new file mode 100644
index 0000000..73d4157
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/child.pom
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>child</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/grandchild.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/grandchild.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/grandchild.pom
new file mode 100644
index 0000000..460bffb
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/grandchild.pom
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>child</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>grandchild</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-collection</groupId>
+      <artifactId>commons-collection</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/parent.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/parent.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/parent.pom
new file mode 100644
index 0000000..8940c99
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/parent.pom
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>bom</artifactId>
+        <version>1.0</version>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent-child.pom
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent-child.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent-child.pom
new file mode 100644
index 0000000..8b712d8
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent-child.pom
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>profile-parent</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>profile-parent-child</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8ff6e5a9/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent.pom
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent.pom
new file mode 100644
index 0000000..74b0135
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/depmgt/profile-parent.pom
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <profiles>
+    <profile>
+      <id>basic</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <dependencyManagement>
+        <dependencies>
+          <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bom</artifactId>
+            <version>1.0</version>
+            <scope>import</scope>
+          </dependency>
+        </dependencies>
+      </dependencyManagement>
+    </profile>
+  </profiles>
+</project>

Reply via email to