ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: [ivy] m2 compatibility WAS Re: svn commit: r1133126 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/plugins/parser/m2/
Date Wed, 08 Jun 2011 14:02:32 GMT
2011/6/8 Nicolas Lalevée <nicolas.lalevee@hibnet.org>:
>
> Le 7 juin 2011 à 20:38, Matt Benson a écrit :
>
>> Hi Ivy devs,
>>  You may have noticed over the past several days that I have
>> committed some m2-related fixes, specifically:
>>
>> https://issues.apache.org/jira/browse/IVY-1299
>> https://issues.apache.org/jira/browse/IVY-1301
>>
>> Both of these issues related to overriding parent properties that
>> specified dependency versions, and I had to do some strange gymnastics
>> to make this work.  A code review by more experienced eyes would
>> probably be best.
>
> I don't know much that part of the code neither. As you patched it you may know better
the code than me ! :)
>
> I think you just missed one thing: update the CHANGES.txt ;)
>

Done; thanks!

Matt

> Nicolas
>
>
>>
>> Thanks,
>> Matt
>>
>> On Tue, Jun 7, 2011 at 1:34 PM,  <mbenson@apache.org> wrote:
>>> Author: mbenson
>>> Date: Tue Jun  7 18:34:01 2011
>>> New Revision: 1133126
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1133126&view=rev
>>> Log:
>>> [IVY-1301] Ivy does not apply overridden properties to parent dependency versions
specified using dependencyManagement properties
>>>
>>> Added:
>>>    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-overrideParentVersionPropertyDependencyMgt.pom
>>>    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-versionPropertyDependencyMgt.pom
>>> Modified:
>>>    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
>>>    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>>>    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
>>>    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
>>>    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
>>>
>>> Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java?rev=1133126&r1=1133125&r2=1133126&view=diff
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
(original)
>>> +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
Tue Jun  7 18:34:01 2011
>>> @@ -184,7 +184,7 @@ public class PomModuleDescriptorBuilder
>>>
>>>
>>>
>>> -    private final DefaultModuleDescriptor ivyModuleDescriptor;
>>> +    private final PomModuleDescriptor ivyModuleDescriptor;
>>>
>>>
>>>     private ModuleRevisionId mrid;
>>> @@ -199,7 +199,7 @@ public class PomModuleDescriptorBuilder
>>>
>>>     public PomModuleDescriptorBuilder(
>>>             ModuleDescriptorParser parser, Resource res, ParserSettings
ivySettings) {
>>> -        ivyModuleDescriptor = new DefaultModuleDescriptor(parser, res);
>>> +        ivyModuleDescriptor = new PomModuleDescriptor(parser, res);
>>>         ivyModuleDescriptor.setResolvedPublicationDate(new Date(res.getLastModified()));
>>>         for (int i = 0; i < MAVEN2_CONFIGURATIONS.length; i++) {
>>>             ivyModuleDescriptor.addConfiguration(MAVEN2_CONFIGURATIONS[i]);
>>> @@ -365,6 +365,8 @@ public class PomModuleDescriptorBuilder
>>>
>>>
>>>     public void addDependencyMgt(PomDependencyMgt dep) {
>>> +        ivyModuleDescriptor.addDependencyManagement(dep);
>>> +
>>>         String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(),
dep.getArtifactId());
>>>         ivyModuleDescriptor.addExtraInfo(key, dep.getVersion());
>>>         if (dep.getScope() != null) {
>>> @@ -450,13 +452,25 @@ public class PomModuleDescriptorBuilder
>>>     }
>>>
>>>     private String getDefaultVersion(PomDependencyData dep) {
>>> +        ModuleId moduleId = ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId());
>>> +        if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(moduleId))
{
>>> +            return ((PomDependencyMgt) ivyModuleDescriptor.getDependencyManagementMap().get(
>>> +                moduleId)).getVersion();
>>> +        }
>>>         String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(),
dep.getArtifactId());
>>>         return (String) ivyModuleDescriptor.getExtraInfo().get(key);
>>>     }
>>>
>>>     private String getDefaultScope(PomDependencyData dep) {
>>> -        String key = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(),
dep.getArtifactId());
>>> -        String result = (String) ivyModuleDescriptor.getExtraInfo().get(key);
>>> +        String result;
>>> +        ModuleId moduleId = ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId());
>>> +        if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(moduleId))
{
>>> +            result = ((PomDependencyMgt) ivyModuleDescriptor.getDependencyManagementMap().get(
>>> +                moduleId)).getScope();
>>> +        } else {
>>> +            String key = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(),
dep.getArtifactId());
>>> +            result = (String) ivyModuleDescriptor.getExtraInfo().get(key);
>>> +        }
>>>         if ((result == null) || !MAVEN2_CONF_MAPPING.containsKey(result))
{
>>>             result = "compile";
>>>         }
>>> @@ -488,6 +502,13 @@ public class PomModuleDescriptorBuilder
>>>                                 ModuleDescriptor descriptor,
>>>                                 String groupId,
>>>                                 String artifactId) {
>>> +        if (descriptor instanceof PomModuleDescriptor) {
>>> +            PomDependencyMgt dependencyMgt = (PomDependencyMgt) ((PomModuleDescriptor)
descriptor)
>>> +                    .getDependencyManagementMap().get(ModuleId.newInstance(groupId,
artifactId));
>>> +            if (dependencyMgt != null) {
>>> +                return dependencyMgt.getExcludedModules();
>>> +            }
>>> +        }
>>>         String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(
>>>                 groupId, artifactId);
>>>         List /*<ModuleId>*/ exclusionIds = new LinkedList /*<ModuleId>*/
();
>>> @@ -506,23 +527,30 @@ public class PomModuleDescriptorBuilder
>>>                 exclusionIds.add(ModuleId.newInstance(exclusionParts[0],
exclusionParts[1]));
>>>             }
>>>         }
>>> -
>>>         return exclusionIds;
>>>     }
>>>
>>>     public static Map/*<ModuleId, String version>*/
>>>             getDependencyManagementMap(ModuleDescriptor md) {
>>>         Map ret = new LinkedHashMap();
>>> -        for (Iterator iterator = md.getExtraInfo().entrySet().iterator();
iterator.hasNext();) {
>>> -            Map.Entry entry = (Map.Entry) iterator.next();
>>> -            String key = (String) entry.getKey();
>>> -            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]),
entry.getValue());
>>> +        if (md instanceof PomModuleDescriptor) {
>>> +            for (final Iterator iterator = ((PomModuleDescriptor) md).getDependencyManagementMap().entrySet().iterator();
iterator.hasNext();) {
>>> +                Map.Entry e = (Entry) iterator.next();
>>> +                PomDependencyMgt dependencyMgt = (PomDependencyMgt)
e.getValue();
>>> +                ret.put(e.getKey(), dependencyMgt.getVersion());
>>> +            }
>>> +        } else {
>>> +            for (Iterator iterator = md.getExtraInfo().entrySet().iterator();
iterator.hasNext();) {
>>> +                Map.Entry entry = (Map.Entry) iterator.next();
>>> +                String key = (String) entry.getKey();
>>> +                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]),
entry.getValue());
>>> +                    }
>>>                 }
>>>             }
>>>         }
>>> @@ -532,34 +560,37 @@ public class PomModuleDescriptorBuilder
>>>     public static List getDependencyManagements(ModuleDescriptor md) {
>>>         List result = new ArrayList();
>>>
>>> -        for (Iterator iterator = md.getExtraInfo().entrySet().iterator();
iterator.hasNext();) {
>>> -            Map.Entry entry = (Map.Entry) iterator.next();
>>> -            String key = (String) entry.getKey();
>>> -            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 {
>>> -                    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";
>>> -
>>> -                    String version = (String) md.getExtraInfo().get(versionKey);
>>> -                    String scope = (String) md.getExtraInfo().get(scopeKey);
>>> -
>>> -                    List /*<ModuleId>*/ exclusions = getDependencyMgtExclusions(md,
parts[1], parts[2]);
>>> -                    result.add(new DefaultPomDependencyMgt(parts[1],
parts[2], version, scope, exclusions));
>>> +        if (md instanceof PomModuleDescriptor) {
>>> +            result.addAll(((PomModuleDescriptor) md).getDependencyManagementMap().values());
>>> +        } else {
>>> +            for (Iterator iterator = md.getExtraInfo().entrySet().iterator();
iterator.hasNext();) {
>>> +                Map.Entry entry = (Map.Entry) iterator.next();
>>> +                String key = (String) entry.getKey();
>>> +                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 {
>>> +                        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";
>>> +
>>> +                        String version = (String) md.getExtraInfo().get(versionKey);
>>> +                        String scope = (String) md.getExtraInfo().get(scopeKey);
>>> +
>>> +                        List /*<ModuleId>*/ exclusions = getDependencyMgtExclusions(md,
parts[1], parts[2]);
>>> +                        result.add(new DefaultPomDependencyMgt(parts[1],
parts[2], version, scope, exclusions));
>>> +                    }
>>>                 }
>>>             }
>>>         }
>>> -
>>>         return result;
>>>     }
>>> -
>>> +
>>>
>>>     public void addExtraInfos(Map extraAttributes) {
>>>         for (Iterator it = extraAttributes.entrySet().iterator(); it.hasNext();)
{
>>> @@ -651,4 +682,20 @@ public class PomModuleDescriptorBuilder
>>>             return pomDependencyData;
>>>         }
>>>     }
>>> +
>>> +    public static class PomModuleDescriptor extends DefaultModuleDescriptor
{
>>> +        private final Map/*<ModuleId, PomDependencyMgt>*/ dependencyManagementMap
= new HashMap();
>>> +
>>> +        public PomModuleDescriptor(ModuleDescriptorParser parser, Resource
res) {
>>> +            super(parser, res);
>>> +        }
>>> +
>>> +        public void addDependencyManagement(PomDependencyMgt dependencyMgt)
{
>>> +            dependencyManagementMap.put(ModuleId.newInstance(dependencyMgt.getGroupId(),
dependencyMgt.getArtifactId()), dependencyMgt);
>>> +        }
>>> +
>>> +        public Map getDependencyManagementMap() {
>>> +            return dependencyManagementMap;
>>> +        }
>>> +    }
>>>  }
>>>
>>> Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=1133126&r1=1133125&r2=1133126&view=diff
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
(original)
>>> +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
Tue Jun  7 18:34:01 2011
>>> @@ -46,6 +46,7 @@ import org.apache.ivy.plugins.parser.Mod
>>>  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.xml.XmlModuleDescriptorWriter;
>>>  import org.apache.ivy.plugins.repository.Resource;
>>>  import org.apache.ivy.plugins.repository.url.URLResource;
>>> @@ -221,7 +222,11 @@ public final class PomModuleDescriptorPa
>>>                     // add dependency management info from parent
>>>                     List depMgt = PomModuleDescriptorBuilder.getDependencyManagements(parentDescr);
>>>                     for (Iterator it = depMgt.iterator(); it.hasNext();)
{
>>> -                        mdBuilder.addDependencyMgt((PomDependencyMgt)
it.next());
>>> +                        PomDependencyMgt dep = (PomDependencyMgt)
it.next();
>>> +                        if (dep instanceof PomDependencyMgtElement)
{
>>> +                            dep = domReader.new PomDependencyMgtElement((PomDependencyMgtElement)
dep);
>>> +                        }
>>> +                        mdBuilder.addDependencyMgt(dep);
>>>                     }
>>>
>>>                     // add plugins from parent
>>>
>>> Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java?rev=1133126&r1=1133125&r2=1133126&view=diff
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
(original)
>>> +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
Tue Jun  7 18:34:01 2011
>>> @@ -294,6 +294,10 @@ public class PomReader {
>>>     public class PomDependencyMgtElement implements PomDependencyMgt {
>>>         private final Element depElement;
>>>
>>> +        public PomDependencyMgtElement(PomDependencyMgtElement copyFrom)
{
>>> +            this(copyFrom.depElement);
>>> +        }
>>> +
>>>         PomDependencyMgtElement(Element depElement) {
>>>             this.depElement = depElement;
>>>         }
>>>
>>> Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1133126&r1=1133125&r2=1133126&view=diff
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
(original)
>>> +++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
Tue Jun  7 18:34:01 2011
>>> @@ -4326,14 +4326,24 @@ public class ResolveTest extends TestCas
>>>         IvyNode ivyNode;
>>>         ivyNode = (IvyNode) dependencies.get(0);
>>>         assertNotNull(ivyNode);
>>> -        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0");
>>> +
>>> +//      Bad assertions based on IVY-1301 bug, corrected below:
>>> +//        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2",
"2.0");
>>> +//        assertEquals(mrid, ivyNode.getId());
>>> +//        // dependencies
>>> +//        assertTrue(getIvyFileInCache(
>>> +//            ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0")).exists());
>>> +//        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"2.0",
>>> +//            "test2", "jar", "jar").exists());
>>> +
>>> +        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2", "1.0");
>>>         assertEquals(mrid, ivyNode.getId());
>>>         // dependencies
>>>         assertTrue(getIvyFileInCache(
>>> -            ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0")).exists());
>>> -        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"2.0",
>>> +            ModuleRevisionId.newInstance("org.apache.dm", "test2", "1.0")).exists());
>>> +        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"1.0",
>>>             "test2", "jar", "jar").exists());
>>> -
>>> +
>>>         ivyNode = (IvyNode) dependencies.get(1);
>>>         assertNotNull(ivyNode);
>>>         mrid = ModuleRevisionId.newInstance("org.apache.dm", "test3", "1.0");
>>> @@ -4423,14 +4433,24 @@ public class ResolveTest extends TestCas
>>>         IvyNode ivyNode;
>>>         ivyNode = (IvyNode) dependencies.get(0);
>>>         assertNotNull(ivyNode);
>>> -        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0");
>>> +
>>> +//      Bad assertions based on IVY-1301 bug, corrected below:
>>> +//        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2",
"2.0");
>>> +//        assertEquals(mrid, ivyNode.getId());
>>> +//        // dependencies
>>> +//        assertTrue(getIvyFileInCache(
>>> +//            ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0")).exists());
>>> +//        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"2.0",
>>> +//            "test2", "jar", "jar").exists());
>>> +
>>> +        mrid = ModuleRevisionId.newInstance("org.apache.dm", "test2", "1.0");
>>>         assertEquals(mrid, ivyNode.getId());
>>>         // dependencies
>>>         assertTrue(getIvyFileInCache(
>>> -            ModuleRevisionId.newInstance("org.apache.dm", "test2", "2.0")).exists());
>>> -        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"2.0",
>>> +            ModuleRevisionId.newInstance("org.apache.dm", "test2", "1.0")).exists());
>>> +        assertTrue(getArchiveFileInCache(ivy, "org.apache.dm", "test2",
"1.0",
>>>             "test2", "jar", "jar").exists());
>>> -
>>> +
>>>         ivyNode = (IvyNode) dependencies.get(1);
>>>         assertNotNull(ivyNode);
>>>         mrid = ModuleRevisionId.newInstance("org.apache.dm", "test3", "1.0");
>>>
>>> Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=1133126&r1=1133125&r2=1133126&view=diff
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
(original)
>>> +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
Tue Jun  7 18:34:01 2011
>>> @@ -675,6 +675,42 @@ public class PomModuleDescriptorParserTe
>>>         assertEquals("jms", excludes[1].getId().getModuleId().getName());
>>>     }
>>>
>>> +    public void testOverrideParentVersionPropertyDependencyMgt() 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("test-versionPropertyDependencyMgt.pom"),
false);
>>> +                    return new ResolvedModuleRevision(null,null,moduleDescriptor,null);
>>> +                } catch (IOException e) {
>>> +                    throw new AssertionError(e);
>>> +                }
>>> +            }
>>> +        });
>>> +
>>> +        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
>>> +            settings, getClass().getResource("test-overrideParentVersionPropertyDependencyMgt.pom"),
false);
>>> +        assertNotNull(md);
>>> +        assertEquals(ModuleRevisionId.newInstance("org.apache", "test-parentdep",
"1.0"), md
>>> +            .getModuleRevisionId());
>>> +
>>> +        DependencyDescriptor[] dds = md.getDependencies();
>>> +        assertNotNull(dds);
>>> +        assertEquals(2, dds.length);
>>> +        assertEquals(ModuleRevisionId.newInstance("commons-collections",
"commons-collections", "3.2.1"),
>>> +            dds[0].getDependencyRevisionId());
>>> +        assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging",
"1.1.1"),
>>> +            dds[1].getDependencyRevisionId());
>>> +
>>> +        ExcludeRule[] excludes = dds[0].getAllExcludeRules();
>>> +        assertNotNull(excludes);
>>> +        assertEquals(2, excludes.length);
>>> +        assertEquals("javax.mail", excludes[0].getId().getModuleId().getOrganisation());
>>> +        assertEquals("mail", excludes[0].getId().getModuleId().getName());
>>> +        assertEquals("javax.jms", excludes[1].getId().getModuleId().getOrganisation());
>>> +        assertEquals("jms", excludes[1].getId().getModuleId().getName());
>>> +    }
>>> +
>>>     public void testParentProperties() throws ParseException, IOException {
>>>         settings.setDictatorResolver(new MockResolver() {
>>>             public ResolvedModuleRevision getDependency(DependencyDescriptor
dd, ResolveData data) throws ParseException {
>>>
>>> Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-overrideParentVersionPropertyDependencyMgt.pom
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-overrideParentVersionPropertyDependencyMgt.pom?rev=1133126&view=auto
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-overrideParentVersionPropertyDependencyMgt.pom
(added)
>>> +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-overrideParentVersionPropertyDependencyMgt.pom
Tue Jun  7 18:34:01 2011
>>> @@ -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>
>>> +  <parent>
>>> +    <artifactId>test-depMgt</artifactId>
>>> +    <groupId>org.apache</groupId>
>>> +    <version>1.0</version>
>>> +  </parent>
>>> +  <groupId>org.apache</groupId>
>>> +  <artifactId>test-parentdep</artifactId>
>>> +  <name>Test Module for Ivy M2 parsing</name>
>>> +  <version>1.0</version>
>>> +  <url>http://ivy.jayasoft.org/</url>
>>> +  <organization>
>>> +    <name>Jayasoft</name>
>>> +    <url>http://www.jayasoft.org/</url>
>>> +  </organization>
>>> +  <properties>
>>> +       <commons.logging.version>1.1.1</commons.logging.version>
>>> +       <commons.collections.version>3.2.1</commons.collections.version>
>>> +  </properties>
>>> +  <dependencies>
>>> +       <dependency>
>>> +        <groupId>commons-collections</groupId>
>>> +        <artifactId>commons-collections</artifactId>
>>> +    </dependency>
>>> +  </dependencies>
>>> +</project>
>>>
>>> Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-versionPropertyDependencyMgt.pom
>>> URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-versionPropertyDependencyMgt.pom?rev=1133126&view=auto
>>> ==============================================================================
>>> --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-versionPropertyDependencyMgt.pom
(added)
>>> +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-versionPropertyDependencyMgt.pom
Tue Jun  7 18:34:01 2011
>>> @@ -0,0 +1,65 @@
>>> +<?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>test-depMgt</artifactId>
>>> +    <name>Test Module for Ivy M2 parsing</name>
>>> +    <version>1.0</version>
>>> +    <url>http://ivy.jayasoft.org/</url>
>>> +    <organization>
>>> +        <name>Jayasoft</name>
>>> +        <url>http://www.jayasoft.org/</url>
>>> +    </organization>
>>> +    <properties>
>>> +       <commons.logging.version>1.0.4</commons.logging.version>
>>> +       <commons.collections.version>1.0.5</commons.collections.version>
>>> +    </properties>
>>> +    <dependencyManagement>
>>> +        <dependencies>
>>> +            <dependency>
>>> +                <groupId>commons-logging</groupId>
>>> +                <artifactId>commons-logging</artifactId>
>>> +                <version>${commons.logging.version}</version>
>>> +            </dependency>
>>> +            <dependency>
>>> +                <groupId>commons-collections</groupId>
>>> +                <artifactId>commons-collections</artifactId>
>>> +                <version>${commons.collections.version}</version>
>>> +                <exclusions>
>>> +                    <exclusion>
>>> +                        <groupId>javax.mail</groupId>
>>> +                        <artifactId>mail</artifactId>
>>> +                    </exclusion>
>>> +                    <exclusion>
>>> +                        <groupId>javax.jms</groupId>
>>> +                        <artifactId>jms</artifactId>
>>> +                    </exclusion>
>>> +                </exclusions>
>>> +            </dependency>
>>> +        </dependencies>
>>> +    </dependencyManagement>
>>> +    <dependencies>
>>> +        <dependency>
>>> +            <groupId>commons-logging</groupId>
>>> +            <artifactId>commons-logging</artifactId>
>>> +        </dependency>
>>> +    </dependencies>
>>> +</project>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>> For additional commands, e-mail: dev-help@ant.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message