diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc index cafaf264..2dd05780 100644 --- a/asciidoc/release-notes.adoc +++ b/asciidoc/release-notes.adoc @@ -50,6 +50,8 @@ For details about the following changes, check our JIRA install at link:https:// - DOCUMENTATION: bla bla bla (jira:IVY-1234[]) (Thanks to Jane Doe) //// +- FIX: improved Maven dependencyManagement matching for dependencies with a non-default type or classifier (IVY-1654) (Thanks to Mark Kittisopikul) + == Committers and Contributors Here is the list of people who have contributed source code and documentation up to this release. Many thanks to all of them, and also to the whole IvyDE community contributing ideas and feedback, and promoting the use of Apache Ivy ! @@ -134,6 +136,7 @@ Here is the list of people who have contributed source code and documentation up * Matthias Kilian * Alexey Kiselev * Gregory Kisling +* Mark Kittisopikul * Stepan Koltsov * Heschi Kreinick * Sebastian Krueger diff --git a/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java b/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java index d0940eb9..bf9aeff8 100644 --- a/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java +++ b/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java @@ -26,16 +26,22 @@ public class DefaultPomDependencyMgt implements PomDependencyMgt { private String artifactId; + private String type; + + private String classifier; + private String version; private String scope; private List excludedModules; - public DefaultPomDependencyMgt(String groupId, String artifactId, String version, String scope, + public DefaultPomDependencyMgt(String groupId, String artifactId, String type, String classifier, String version, String scope, List excludedModules) { this.groupId = groupId; this.artifactId = artifactId; + this.type = type; + this.classifier = classifier; this.version = version; this.scope = scope; this.excludedModules = excludedModules; @@ -53,6 +59,15 @@ public class DefaultPomDependencyMgt implements PomDependencyMgt { return artifactId; } + public String getType() { + return type; + } + + @Override + public String getClassifier() { + return classifier; + } + public String getVersion() { return version; } diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomDependencyMgt.java b/src/java/org/apache/ivy/plugins/parser/m2/PomDependencyMgt.java index 703b7314..23c3ec82 100644 --- a/src/java/org/apache/ivy/plugins/parser/m2/PomDependencyMgt.java +++ b/src/java/org/apache/ivy/plugins/parser/m2/PomDependencyMgt.java @@ -27,6 +27,10 @@ public interface PomDependencyMgt { String getArtifactId(); + String getType(); + + String getClassifier(); + String getVersion(); String getScope(); 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 3c6eff88..e5949d9a 100644 --- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java +++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java @@ -17,16 +17,7 @@ */ package org.apache.ivy.plugins.parser.m2; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; import org.apache.ivy.core.cache.ArtifactOrigin; import org.apache.ivy.core.module.descriptor.Artifact; @@ -55,6 +46,7 @@ import org.apache.ivy.plugins.resolver.DependencyResolver; import org.apache.ivy.util.Message; import static org.apache.ivy.core.module.descriptor.Configuration.Visibility.PUBLIC; +import static org.apache.ivy.util.StringUtils.defaultIfEmpty; import static org.apache.ivy.util.StringUtils.isNullOrEmpty; /** @@ -298,8 +290,7 @@ public class PomModuleDescriptorBuilder { // is present, but empty. List excluded = dep.getExcludedModules(); if (excluded.isEmpty()) { - excluded = getDependencyMgtExclusions(ivyModuleDescriptor, dep.getGroupId(), - dep.getArtifactId()); + excluded = getDependencyMgtExclusions(ivyModuleDescriptor, dep); } final boolean excludeAllTransitiveDeps = shouldExcludeAllTransitiveDeps(excluded); // the same dependency mrid could appear twice in the module descriptor, @@ -414,16 +405,14 @@ public class PomModuleDescriptorBuilder { public void addDependencyMgt(PomDependencyMgt dep) { ivyModuleDescriptor.addDependencyManagement(dep); - String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(), dep.getArtifactId()); + String key = getDependencyMgtExtraInfoKeyForVersion(dep); overwriteExtraInfoIfExists(key, dep.getVersion()); if (dep.getScope() != null) { - String scopeKey = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(), - dep.getArtifactId()); + String scopeKey = getDependencyMgtExtraInfoKeyForScope(dep); overwriteExtraInfoIfExists(scopeKey, dep.getScope()); } if (!dep.getExcludedModules().isEmpty()) { - String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(dep.getGroupId(), - dep.getArtifactId()); + String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(dep); int index = 0; for (ModuleId excludedModule : dep.getExcludedModules()) { overwriteExtraInfoIfExists( @@ -494,6 +483,14 @@ public class PomModuleDescriptorBuilder { return artifactId; } + public String getType() { + return null; + } + + public String getClassifier() { + return null; + } + public String getVersion() { return version; } @@ -508,22 +505,22 @@ public class PomModuleDescriptorBuilder { } private String getDefaultVersion(PomDependencyData dep) { - ModuleId moduleId = ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId()); - if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(moduleId)) { - return ivyModuleDescriptor.getDependencyManagementMap().get(moduleId).getVersion(); + DependencyMgtKey key = new DependencyMgtKey(dep); + if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(key)) { + return ivyModuleDescriptor.getDependencyManagementMap().get(key).getVersion(); } - String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(), dep.getArtifactId()); - return ivyModuleDescriptor.getExtraInfoContentByTagName(key); + String tagName = getDependencyMgtExtraInfoKeyForVersion(dep); + return ivyModuleDescriptor.getExtraInfoContentByTagName(tagName); } private String getDefaultScope(PomDependencyData dep) { String result; - ModuleId moduleId = ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId()); - if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(moduleId)) { - result = ivyModuleDescriptor.getDependencyManagementMap().get(moduleId).getScope(); + DependencyMgtKey key = new DependencyMgtKey(dep); + if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(key)) { + result = ivyModuleDescriptor.getDependencyManagementMap().get(key).getScope(); } else { - String key = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(), dep.getArtifactId()); - result = ivyModuleDescriptor.getExtraInfoContentByTagName(key); + String tagname = getDependencyMgtExtraInfoKeyForScope(dep); + result = ivyModuleDescriptor.getExtraInfoContentByTagName(tagname); } if (result == null || !MAVEN2_CONF_MAPPING.containsKey(result)) { result = "compile"; @@ -531,36 +528,58 @@ public class PomModuleDescriptorBuilder { return result; } - private static String getDependencyMgtExtraInfoKeyForVersion(String groupId, String artifactId) { - return DEPENDENCY_MANAGEMENT + EXTRA_INFO_DELIMITER + groupId + EXTRA_INFO_DELIMITER - + artifactId + EXTRA_INFO_DELIMITER + "version"; + private static String getDependencyMgtExtraInfoKeyForVersion(PomDependencyMgt dep) { + return getDependencyMgtExtraInfoKeyForProperty(dep, "version"); } - private static String getDependencyMgtExtraInfoKeyForScope(String groupId, String artifactId) { - return DEPENDENCY_MANAGEMENT + EXTRA_INFO_DELIMITER + groupId + EXTRA_INFO_DELIMITER - + artifactId + EXTRA_INFO_DELIMITER + "scope"; + private static String getDependencyMgtExtraInfoKeyForScope(PomDependencyMgt dep) { + return getDependencyMgtExtraInfoKeyForProperty(dep, "scope"); + } + + private static String getDependencyMgtExtraInfoPrefixForExclusion(PomDependencyMgt dep) { + return getDependencyMgtExtraInfoKeyForProperty(dep, "exclusion_"); + } + + private static String getDependencyMgtExtraInfoKeyForProperty(PomDependencyMgt dep, String propertyName) { + StringBuilder result = new StringBuilder(DEPENDENCY_MANAGEMENT); + result.append(EXTRA_INFO_DELIMITER) + .append(dep.getGroupId()) + .append(EXTRA_INFO_DELIMITER) + .append(dep.getArtifactId()); + + // If the type and classifier are the default values, we don't need to include them in the key. + // However, if the type is the default value, but the classifier is not, we also do add the type. + // Otherwise, we can't distinguish between a + // - default type with a non-default classifier; and + // - non-default type with a default classifier. + String type = defaultIfEmpty(dep.getType(), DependencyMgtKey.DEFAULT_TYPE); + String classifier = dep.getClassifier(); + if (classifier != null || !DependencyMgtKey.DEFAULT_TYPE.equals(type)) { + result.append(EXTRA_INFO_DELIMITER) + .append(type); + } + if (classifier != null) { + result.append(EXTRA_INFO_DELIMITER) + .append(classifier); + } + result.append(EXTRA_INFO_DELIMITER) + .append(propertyName); + return result.toString(); } private static String getPropertyExtraInfoKey(String propertyName) { return PROPERTIES + EXTRA_INFO_DELIMITER + propertyName; } - private static String getDependencyMgtExtraInfoPrefixForExclusion(String groupId, - String artifactId) { - return DEPENDENCY_MANAGEMENT + EXTRA_INFO_DELIMITER + groupId + EXTRA_INFO_DELIMITER - + artifactId + EXTRA_INFO_DELIMITER + "exclusion_"; - } - - private static List getDependencyMgtExclusions(ModuleDescriptor descriptor, - String groupId, String artifactId) { + private static List getDependencyMgtExclusions(ModuleDescriptor descriptor, PomDependencyMgt dep) { if (descriptor instanceof PomModuleDescriptor) { PomDependencyMgt dependencyMgt = ((PomModuleDescriptor) descriptor) - .getDependencyManagementMap().get(ModuleId.newInstance(groupId, artifactId)); + .getDependencyManagementMap().get(new DependencyMgtKey(dep)); if (dependencyMgt != null) { return dependencyMgt.getExcludedModules(); } } - String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(groupId, artifactId); + String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(dep); List exclusionIds = new LinkedList<>(); for (ExtraInfoHolder extraInfoHolder : descriptor.getExtraInfos()) { String key = extraInfoHolder.getName(); @@ -578,32 +597,6 @@ public class PomModuleDescriptorBuilder { return exclusionIds; } - public static Map getDependencyManagementMap(ModuleDescriptor md) { - Map ret = new LinkedHashMap<>(); - if (md instanceof PomModuleDescriptor) { - for (Map.Entry e : ((PomModuleDescriptor) md) - .getDependencyManagementMap().entrySet()) { - PomDependencyMgt dependencyMgt = e.getValue(); - ret.put(e.getKey(), dependencyMgt.getVersion()); - } - } else { - for (ExtraInfoHolder extraInfoHolder : md.getExtraInfos()) { - String key = extraInfoHolder.getName(); - 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 " - + "doesn't match expected pattern: " + key); - } else { - ret.put(ModuleId.newInstance(parts[1], parts[2]), - extraInfoHolder.getContent()); - } - } - } - } - return ret; - } - public static List getDependencyManagements(ModuleDescriptor md) { List result = new ArrayList<>(); @@ -614,23 +607,31 @@ public class PomModuleDescriptorBuilder { String key = extraInfoHolder.getName(); if (key.startsWith(DEPENDENCY_MANAGEMENT)) { String[] parts = key.split(EXTRA_INFO_DELIMITER); - if (parts.length != DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT) { + if (parts.length < DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT || parts.length > DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT + 2) { Message.warn("what seem to be a dependency management extra info " + "doesn't match expected pattern: " + key); } else { - String versionKey = DEPENDENCY_MANAGEMENT + EXTRA_INFO_DELIMITER + parts[1] - + EXTRA_INFO_DELIMITER + parts[2] + EXTRA_INFO_DELIMITER - + "version"; - String scopeKey = DEPENDENCY_MANAGEMENT + EXTRA_INFO_DELIMITER + parts[1] - + EXTRA_INFO_DELIMITER + parts[2] + EXTRA_INFO_DELIMITER + "scope"; + //m:dependency.management__groupId__artifactId[__type[__classifier]]__version + String groupId = parts[1]; + String artifactId = parts[2]; + String type = null; + String classifier = null; + + if (parts.length == DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT + 1) { + type = parts[3]; + } else if (parts.length == DEPENDENCY_MANAGEMENT_KEY_PARTS_COUNT + 2) { + type = parts[3]; + classifier = parts[4]; + } + + PomDependencyMgt dep = new DefaultPomDependencyMgt(groupId, artifactId, type, classifier, null, null, null); + String versionKey = getDependencyMgtExtraInfoKeyForVersion(dep); + String scopeKey = getDependencyMgtExtraInfoKeyForScope(dep); String version = md.getExtraInfoContentByTagName(versionKey); String scope = md.getExtraInfoContentByTagName(scopeKey); - - List exclusions = getDependencyMgtExclusions(md, parts[1], - parts[2]); - result.add(new DefaultPomDependencyMgt(parts[1], parts[2], version, scope, - exclusions)); + List exclusions = getDependencyMgtExclusions(md, dep); + result.add(new DefaultPomDependencyMgt(groupId, artifactId, type, classifier, version, scope, exclusions)); } } } @@ -754,7 +755,7 @@ public class PomModuleDescriptorBuilder { } public static class PomModuleDescriptor extends DefaultModuleDescriptor { - private final Map dependencyManagementMap = new LinkedHashMap<>(); + private final Map dependencyManagementMap = new LinkedHashMap<>(); // dependency descriptor keyed by its dependency revision id private final Map depDescriptors = new HashMap<>(); @@ -763,12 +764,10 @@ public class PomModuleDescriptorBuilder { } public void addDependencyManagement(PomDependencyMgt dependencyMgt) { - dependencyManagementMap.put( - ModuleId.newInstance(dependencyMgt.getGroupId(), dependencyMgt.getArtifactId()), - dependencyMgt); + dependencyManagementMap.put(new DependencyMgtKey(dependencyMgt), dependencyMgt); } - public Map getDependencyManagementMap() { + public Map getDependencyManagementMap() { return dependencyManagementMap; } @@ -778,4 +777,52 @@ public class PomModuleDescriptorBuilder { this.depDescriptors.put(dependency.getDependencyRevisionId(), dependency); } } + + public static class DependencyMgtKey { + + private static final String DEFAULT_TYPE = "jar"; + + private final ModuleId moduleId; + private final String type; // default to 'jar' if not specified + private final String classifier; // default to null if not specified + + public DependencyMgtKey(PomDependencyMgt dependencyMgt) { + moduleId = ModuleId.newInstance(dependencyMgt.getGroupId(), dependencyMgt.getArtifactId()); + type = defaultIfEmpty(dependencyMgt.getType(), DEFAULT_TYPE); + classifier = dependencyMgt.getClassifier(); + } + + public String getGroupId() { + return moduleId.getOrganisation(); + } + + public String getArtifactId() { + return moduleId.getName(); + } + + public String getType() { + return type; + } + + public String getClassifier() { + return classifier; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof DependencyMgtKey)) { + return false; + } + + DependencyMgtKey that = (DependencyMgtKey) obj; + return Objects.equals(moduleId, that.moduleId) + && Objects.equals(type, that.type) + && Objects.equals(classifier, that.classifier); + } + + @Override + public int hashCode() { + return Objects.hash(moduleId, type, classifier); + } + } } 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 11964f54..78d602fb 100644 --- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java +++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java @@ -351,8 +351,8 @@ public final class PomModuleDescriptorParser implements ModuleDescriptorParser { // add dependency management info from imported module for (PomDependencyMgt importedDepMgt : getDependencyManagements(importDescr)) { mdBuilder.addDependencyMgt(new DefaultPomDependencyMgt(importedDepMgt.getGroupId(), - importedDepMgt.getArtifactId(), importedDepMgt.getVersion(), - importedDepMgt.getScope(), importedDepMgt.getExcludedModules())); + importedDepMgt.getArtifactId(), importedDepMgt.getType(), importedDepMgt.getClassifier(), + importedDepMgt.getVersion(), importedDepMgt.getScope(), importedDepMgt.getExcludedModules())); } } else { mdBuilder.addDependencyMgt(dep); 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 2bafc9b2..fda3e9f8 100644 --- a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java +++ b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java @@ -394,6 +394,18 @@ public class PomReader { return replaceProps(val); } + @Override + public String getType() { + String val = getFirstChildText(depElement, TYPE); + return emptyIsNull(replaceProps(val)); + } + + @Override + public String getClassifier() { + String val = getFirstChildText(depElement, CLASSIFIER); + return emptyIsNull(replaceProps(val)); + } + /* * (non-Javadoc) * @@ -406,7 +418,7 @@ public class PomReader { public String getScope() { String val = getFirstChildText(depElement, SCOPE); - return replaceProps(val); + return emptyIsNull(replaceProps(val)); } public List getExcludedModules() { @@ -428,6 +440,23 @@ public class PomReader { } return exclusions; } + + /** + * We return null where certain elements within a pom don't have a value specified. + * For example, there are pom.xml out there which just use "" in the dependencies. + * (dependencies in org.seleniumhq.selenium:selenium-java:3.141.59 are one such example) + * We do this so that callers of such elements don't have to keep repeating checks for empty value. + * For us an empty value, for many of such elements, is really the same as that element not being specified + * + * @param val The value to check + * @return + */ + private String emptyIsNull(final String val) { + if (val == null) { + return null; + } + return val.isEmpty() ? null : val; + } } public List getPlugins() { @@ -487,6 +516,16 @@ public class PomReader { return replaceProps(val); } + @Override + public String getType() { + return null; + } + + @Override + public String getClassifier() { + return null; + } + public String getScope() { return null; // not used } @@ -508,42 +547,9 @@ public class PomReader { this.depElement = depElement; } - @Override - public String getScope() { - String val = getFirstChildText(depElement, SCOPE); - return emptyIsNull(replaceProps(val)); - } - - public String getClassifier() { - String val = getFirstChildText(depElement, CLASSIFIER); - return emptyIsNull(replaceProps(val)); - } - - public String getType() { - String val = getFirstChildText(depElement, TYPE); - return emptyIsNull(replaceProps(val)); - } - public boolean isOptional() { return Boolean.parseBoolean(getFirstChildText(depElement, OPTIONAL)); } - - /** - * We return null where certain elements within a pom don't have a value specified. - * For example, there are pom.xml out there which just use "" in the dependencies. - * (dependencies in org.seleniumhq.selenium:selenium-java:3.141.59 are one such example) - * We do this so that callers of such elements don't have to keep repeating checks for empty value. - * For us an empty value, for many of such elements, is really the same as that element not being specified - * - * @param val The value to check - * @return - */ - private String emptyIsNull(final String val) { - if (val == null) { - return null; - } - return val.equals("") ? null : val; - } } public class PomProfileElement { diff --git a/src/java/org/apache/ivy/util/StringUtils.java b/src/java/org/apache/ivy/util/StringUtils.java index 2c055856..f8c46a42 100644 --- a/src/java/org/apache/ivy/util/StringUtils.java +++ b/src/java/org/apache/ivy/util/StringUtils.java @@ -244,4 +244,9 @@ public final class StringUtils { } return sb.toString(); } + + public static String defaultIfEmpty(String value, String defaultValue) { + return (value == null || value.isEmpty()) ? defaultValue : value; + } + } 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 a9673cc0..58f6f47b 100644 --- a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java +++ b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java @@ -873,6 +873,44 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertEquals("The configuration must be test", "test", dds[0].getModuleConfigurations()[0]); } + @Test + public void testDependencyManagementWithClassifier() throws ParseException, IOException { + ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, + getClass().getResource("test-dependencyMgt-with-classifier.pom"), false); + assertNotNull(md); + assertEquals(ModuleRevisionId.newInstance("org.apache", "test-depMgt", "1.1"), + md.getModuleRevisionId()); + + DependencyDescriptor[] dds = md.getDependencies(); + assertNotNull(dds); + assertEquals(1, dds.length); + assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), + dds[0].getDependencyRevisionId()); + assertEquals(1, dds[0].getAllDependencyArtifacts().length); + assertEquals("jar", dds[0].getAllDependencyArtifacts()[0].getExt()); + assertEquals("jar", dds[0].getAllDependencyArtifacts()[0].getType()); + Map extraAtt = Collections.singletonMap("classifier", "asl"); + assertEquals(extraAtt, dds[0].getAllDependencyArtifacts()[0].getExtraAttributes()); + } + + @Test + public void testDependencyManagementWithType() throws ParseException, IOException { + ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, + getClass().getResource("test-dependencyMgt-with-type.pom"), false); + assertNotNull(md); + assertEquals(ModuleRevisionId.newInstance("org.apache", "test-depMgt", "1.1"), + md.getModuleRevisionId()); + + DependencyDescriptor[] dds = md.getDependencies(); + assertNotNull(dds); + assertEquals(1, dds.length); + assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), + dds[0].getDependencyRevisionId()); + assertEquals(1, dds[0].getAllDependencyArtifacts().length); + assertEquals("dll", dds[0].getAllDependencyArtifacts()[0].getExt()); + assertEquals("dll", dds[0].getAllDependencyArtifacts()[0].getType()); + } + @Test public void testParentDependencyMgt() throws ParseException, IOException { settings.setDictatorResolver(new MockResolver() { diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-classifier.pom b/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-classifier.pom new file mode 100644 index 00000000..194971b7 --- /dev/null +++ b/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-classifier.pom @@ -0,0 +1,53 @@ + + + + 4.0.0 + org.apache + test-depMgt + Test Module for Ivy M2 parsing + 1.1 + http://ivy.jayasoft.org/ + + Jayasoft + http://www.jayasoft.org/ + + + + + commons-logging + commons-logging + asl + 1.0.4 + + + commons-collection + commons-collection + 1.0.5 + + + + + + commons-logging + commons-logging + asl + + + diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-type.pom b/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-type.pom new file mode 100644 index 00000000..2ad0d3f4 --- /dev/null +++ b/test/java/org/apache/ivy/plugins/parser/m2/test-dependencyMgt-with-type.pom @@ -0,0 +1,53 @@ + + + + 4.0.0 + org.apache + test-depMgt + Test Module for Ivy M2 parsing + 1.1 + http://ivy.jayasoft.org/ + + Jayasoft + http://www.jayasoft.org/ + + + + + commons-logging + commons-logging + dll + 1.0.4 + + + commons-collection + commons-collection + 1.0.5 + + + + + + commons-logging + commons-logging + dll + + +