Repository: ant-ivy
Updated Branches:
  refs/heads/2.4.x a89c1fec1 -> 57892b6e8


Merging several commits from master into the 2.4.x branch.


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

Branch: refs/heads/2.4.x
Commit: 57892b6e81399fa57fcfc1140ceac3398d955554
Parents: a89c1fe
Author: Maarten Coene <maart...@apache.org>
Authored: Thu May 22 23:29:06 2014 +0200
Committer: Maarten Coene <maart...@apache.org>
Committed: Tue May 27 00:30:09 2014 +0200

----------------------------------------------------------------------
 .gitignore                                      |  2 +
 CHANGES.txt                                     |  4 ++
 build-release.xml                               |  5 +-
 .../descriptor/DefaultModuleDescriptor.java     | 40 +++++++++++---
 .../module/descriptor/ModuleDescriptor.java     | 26 +++++++--
 .../apache/ivy/core/report/ResolveReport.java   |  1 +
 .../apache/ivy/osgi/core/BundleInfoAdapter.java |  3 +-
 .../parser/m2/PomModuleDescriptorWriter.java    | 25 +++++++--
 .../parser/xml/XmlModuleDescriptorParser.java   |  3 +-
 .../ivy/plugins/repository/ssh/SshCache.java    |  3 +-
 .../plugins/resolver/util/ResolverHelper.java   | 14 ++---
 .../m2/PomModuleDescriptorWriterTest.java       | 15 ++++++
 .../ivy/plugins/parser/m2/test-transitive.pom   | 42 +++++++++++++++
 .../ivy/plugins/parser/m2/test-transitive.xml   | 24 +++++++++
 .../xml/XmlModuleDescriptorWriterTest.java      | 20 +++++++
 .../xml/test-write-extrainfo-from-maven.xml     | 55 ++++++++++++++++++++
 16 files changed, 252 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index e3a7943..dac4fd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ test/test-repo/ivyrepo/org.apache.ivy.osgi
 .DS_Store
 doc/samples/target-platform/bundles
 doc/samples/target-platform/cache
+.idea
+*.iml
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0b41016..aeb124b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -144,8 +144,12 @@ for detailed view of each issue, please consult 
http://issues.apache.org/jira/br
 =====================================
 - IMPROVEMENT: Add support for packed jar within an OSGi bundle
 - IMPROVEMENT: ModuleRules.getRule is O(n) leading to resolution slowness 
(IVY-1465) (Thanks to Zhong Wang aka Kewpie)
+- IMPROVEMENT: ivy:makepom will generate an exclusion when transitive=false on 
a dependency (IVY-1470)
 
 - FIX: impossible to get artifacts when data has not been loaded. (IVY-1399) 
(Thanks to David Turner)
+- FIX: regression introduced by IVY-1457, dependency management wasn't 
properly handled introducing lots of resolution failures
+- FIX: The SSH resolvers fails if the un-required jsch jar is missing 
(IVY-1471)
+- FIX: failed to resolve dynamic revisions in some cases for URL repositories 
(IVY-1472)
 
    2.4.0-rc1
 =====================================

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/build-release.xml
----------------------------------------------------------------------
diff --git a/build-release.xml b/build-release.xml
index 9b9cc5a..a164d67 100644
--- a/build-release.xml
+++ b/build-release.xml
@@ -239,7 +239,10 @@
                        <zipfileset dir="${basedir}/src/example" 
prefix="${snapshot.full.name}/src/example"/>
                        <zipfileset dir="${basedir}/src/etc" 
prefix="${snapshot.full.name}/src/etc"/>
                        <zipfileset dir="${test.dir}" 
prefix="${snapshot.full.name}/test/java"/>
-                       <zipfileset dir="${basedir}/test/repositories" 
prefix="${snapshot.full.name}/test/repositories"/>
+            <zipfileset dir="${basedir}/test/test-obr" 
prefix="${snapshot.full.name}/test/test-obr" />
+            <zipfileset dir="${basedir}/test/test-p2" 
prefix="${snapshot.full.name}/test/test-p2" />
+            <zipfileset dir="${basedir}/test/test-repo" 
prefix="${snapshot.full.name}/test/test-repo" 
excludes="**/bundlerepo/*.jar,**/ivyrepo/org*" />
+            <zipfileset dir="${basedir}/test/repositories" 
prefix="${snapshot.full.name}/test/repositories"/>
                        <zipfileset dir="${basedir}/test/buildlist" 
prefix="${snapshot.full.name}/test/buildlist"/>
                        <zipfileset dir="${basedir}/test/triggers" 
prefix="${snapshot.full.name}/test/triggers" excludes="**/cache/**"/>
                        <zipfileset dir="${basedir}/test/xsl" 
prefix="${snapshot.full.name}/test/xsl"/>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java 
b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
index 43de686..2c544c5 100644
--- 
a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
+++ 
b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
@@ -194,7 +194,6 @@ public class DefaultModuleDescriptor implements 
ModuleDescriptor {
         nmd.description = md.getDescription();
         nmd.lastModified = md.getLastModified();
         nmd.extraAttributesNamespaces = md.getExtraAttributesNamespaces();
-        nmd.extraInfo = md.getExtraInfo();
         nmd.extraInfos = md.getExtraInfos();
         nmd.namespace = ns;
 
@@ -256,8 +255,6 @@ public class DefaultModuleDescriptor implements 
ModuleDescriptor {
 
     private Map/* <String,String> */extraAttributesNamespaces = new 
LinkedHashMap();
 
-    private Map/* <String,String> */extraInfo = new HashMap();
-
     private List<ExtraInfoHolder> extraInfos = new 
ArrayList<ExtraInfoHolder>();
 
     public DefaultModuleDescriptor(ModuleRevisionId id, String status, Date 
pubDate) {
@@ -837,12 +834,25 @@ public class DefaultModuleDescriptor implements 
ModuleDescriptor {
         extraAttributesNamespaces.put(prefix, namespace);
     }
 
+    @Deprecated
     public void addExtraInfo(String infoKey, String value) {
-        extraInfo.put(infoKey, value);
+        extraInfos.add(new ExtraInfoHolder(infoKey, value));
     }
 
-    public Map getExtraInfo() {
-        return extraInfo;
+    @Deprecated
+    public Map<String, String> getExtraInfo() {
+        Map<String, String> map = new HashMap<String, String>();
+        for (ExtraInfoHolder extraInfo : extraInfos) {
+            populateExtraInfoMap(map, extraInfo);
+        }
+        return map;
+    }
+
+    private void populateExtraInfoMap(Map<String, String> map, ExtraInfoHolder 
extraInfo) {
+        map.put(extraInfo.getName(), extraInfo.getContent());
+        for (ExtraInfoHolder nested : extraInfo.getNestedExtraInfoHolder()) {
+            populateExtraInfoMap(map, nested);
+        }
     }
 
     public List<ExtraInfoHolder> getExtraInfos() {
@@ -852,4 +862,22 @@ public class DefaultModuleDescriptor implements 
ModuleDescriptor {
     public void addExtraInfo(ExtraInfoHolder extraInfo) {
         extraInfos.add(extraInfo);
     }
+
+    public String getExtraInfoContentByTagName(String tagName) {
+        ExtraInfoHolder extraInfoByTagName = getExtraInfoByTagName(tagName);
+        if (extraInfoByTagName != null) {
+            return extraInfoByTagName.getContent();
+        }
+        return null;
+    }
+
+    public ExtraInfoHolder getExtraInfoByTagName(String tagName) {
+        for (ExtraInfoHolder extraInfoHolder : extraInfos) {
+            if (extraInfoHolder.getName().equals(tagName)) {
+                return extraInfoHolder;
+            }
+        }
+        return null;
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java 
b/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
index fc09715..4eb4a1e 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
@@ -254,22 +254,40 @@ public interface ModuleDescriptor extends ExtendableItem, 
ArtifactInfo,
      * @return the list of xml namespaces used by extra attributes, as Map 
from prefix to namespace
      *         URIs.
      */
-    Map/* <String,String> */getExtraAttributesNamespaces();
+    Map<String, String> getExtraAttributesNamespaces();
 
     /**
      * Returns the custom info provided in the info tag. All the tags except 
the description are
-     * given. The key is the name of the tag, the value is its content.
+     * given. The key is the name of the tag, the value is its content. <br />
      * 
-     * @return
+     * @deprecated this method is not returning the full content of the extra 
info: to get the full
+     *             structure of the extra infos, use getExtraInfos()
      */
     @Deprecated
-    Map/* <String,String> */getExtraInfo();
+    Map<String, String> getExtraInfo();
 
     /**
      * Returns a list of extras infos (tag name, attributes and content). All 
the tags except the
      * description are given.
      * 
+     * @since 2.4.0
      * @return
      */
     List<ExtraInfoHolder> getExtraInfos();
+
+    /**
+     * Returns content from first extrainfo matching with given tag name
+     * 
+     * @since 2.4.0
+     * @return
+     */
+    String getExtraInfoContentByTagName(String tagName);
+
+    /**
+     * Returns first extrainfo matching with given tag name
+     * 
+     * @since 2.4.0
+     * @return
+     */
+    ExtraInfoHolder getExtraInfoByTagName(String tagName);
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/core/report/ResolveReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/ResolveReport.java 
b/src/java/org/apache/ivy/core/report/ResolveReport.java
index 54732aa..0f12488 100644
--- a/src/java/org/apache/ivy/core/report/ResolveReport.java
+++ b/src/java/org/apache/ivy/core/report/ResolveReport.java
@@ -371,6 +371,7 @@ public class ResolveReport {
     public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, 
List<ModuleId> midToKeep) {
         DefaultModuleDescriptor fixedmd = new 
DefaultModuleDescriptor(md.getModuleRevisionId(),
                 md.getStatus(), new Date());
+        fixedmd.getExtraInfos().addAll(md.getExtraInfos());
 
         // copy configurations
         List<String> resolvedConfs = Arrays.asList(getConfigurations());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java 
b/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
index 27a24c0..fa9cf0e 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
@@ -166,7 +166,8 @@ public class BundleInfoAdapter {
 
         if (manifest != null) {
             for (Entry<Object, Object> entries : 
manifest.getMainAttributes().entrySet()) {
-                md.addExtraInfo(entries.getKey().toString(), 
entries.getValue().toString());
+                md.addExtraInfo(new 
ExtraInfoHolder(entries.getKey().toString(), entries.getValue()
+                        .toString()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
index 5e62288..5cd254a 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
@@ -228,7 +228,7 @@ public final class PomModuleDescriptorWriter {
                     version = md.getModuleRevisionId().getRevision();
                 }
                 printDependency(out, indent, groupId, dep.getArtifact(), 
version, dep.getType(),
-                    dep.getClassifier(), dep.getScope(), dep.isOptional(), 
null);
+                    dep.getClassifier(), dep.getScope(), dep.isOptional(), 
true, null);
             }
 
             // now print the dependencies listed in the ModuleDescriptor
@@ -251,13 +251,15 @@ public final class PomModuleDescriptorWriter {
                         String scope = 
mapping.getScope(dds[i].getModuleConfigurations());
                         boolean optional = 
mapping.isOptional(dds[i].getModuleConfigurations());
                         printDependency(out, indent, mrid.getOrganisation(), 
mrid.getName(),
-                            mrid.getRevision(), type, classifier, scope, 
optional, excludes);
+                            mrid.getRevision(), type, classifier, scope, 
optional,
+                            dds[i].isTransitive(), excludes);
                     }
                 } else {
                     String scope = 
mapping.getScope(dds[i].getModuleConfigurations());
                     boolean optional = 
mapping.isOptional(dds[i].getModuleConfigurations());
                     printDependency(out, indent, mrid.getOrganisation(), 
mrid.getName(),
-                        mrid.getRevision(), null, null, scope, optional, 
excludes);
+                        mrid.getRevision(), null, null, scope, optional, 
dds[i].isTransitive(),
+                        excludes);
                 }
             }
 
@@ -270,7 +272,7 @@ public final class PomModuleDescriptorWriter {
 
     private static void printDependency(PrintWriter out, int indent, String 
groupId,
             String artifactId, String version, String type, String classifier, 
String scope,
-            boolean isOptional, ExcludeRule[] excludes) {
+            boolean isOptional, boolean isTransitive, ExcludeRule[] excludes) {
         indent(out, indent * 2);
         out.println("<dependency>");
         indent(out, indent * 3);
@@ -295,7 +297,20 @@ public final class PomModuleDescriptorWriter {
             indent(out, indent * 3);
             out.println("<optional>true</optional>");
         }
-        if (excludes != null) {
+        if (!isTransitive) {
+            indent(out, indent * 3);
+            out.println("<exclusions>");
+            indent(out, indent * 4);
+            out.println("<exclusion>");
+            indent(out, indent * 5);
+            out.println("<groupId>*</groupId>");
+            indent(out, indent * 5);
+            out.println("<artifactId>*</artifactId>");
+            indent(out, indent * 4);
+            out.println("</exclusion>");
+            indent(out, indent * 3);
+            out.println("</exclusions>");
+        } else if (excludes != null) {
             printExclusions(excludes, out, indent);
         }
         indent(out, indent * 2);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java 
b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
index 800b963..de28d74 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
@@ -562,7 +562,7 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                 descriptor.setNamespace(parentNamespace);
             }
 
-            descriptor.getExtraInfo().putAll(parent.getExtraInfo());
+            descriptor.getExtraInfos().addAll(parent.getExtraInfos());
         }
 
         private static String mergeRevisionValue(String inherited, String 
override) {
@@ -1250,7 +1250,6 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
             } else if (state == State.EXTRA_INFO) {
                 String content = buffer == null ? "" : buffer.toString();
                 buffer = null;
-                getMd().addExtraInfo(qName, content);
                 ExtraInfoHolder extraInfo = extraInfoStack.pop();
                 extraInfo.setContent(content);
                 if (extraInfoStack.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java 
b/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
index f28a6a6..095ec61 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
@@ -39,7 +39,6 @@ import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
 import com.jcraft.jsch.UIKeyboardInteractive;
 import com.jcraft.jsch.UserInfo;
-import com.jcraft.jsch.agentproxy.AgentProxyException;
 import com.jcraft.jsch.agentproxy.Connector;
 import com.jcraft.jsch.agentproxy.ConnectorFactory;
 import com.jcraft.jsch.agentproxy.RemoteIdentityRepository;
@@ -302,7 +301,7 @@ public final class SshCache {
             Connector con = ConnectorFactory.getDefault().createConnector();
             jsch.setIdentityRepository(new RemoteIdentityRepository(con));
             return true;
-        } catch (AgentProxyException e) {
+        } catch (Exception e) {
             Message.verbose(":: SSH :: Failure connecting to agent :: " + 
e.toString());
             return false;
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java 
b/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
index 7505696..91411a9 100644
--- a/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
+++ b/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
@@ -61,10 +61,10 @@ public final class ResolverHelper {
 
             try {
                 Message.debug("\tusing " + rep + " to list all in " + root);
-                List all = rep.list(root);
+                String[] all = listAll(rep, root);
                 if (all != null) {
-                    Message.debug("\t\tfound " + all.size() + " urls");
-                    List ret = new ArrayList(all.size());
+                    Message.debug("\t\tfound " + all.length + " urls");
+                    List<String> ret = new ArrayList<String>(all.length);
                     int endNameIndex = pattern.indexOf(fileSep, slashIndex + 
1);
                     String namePattern;
                     if (endNameIndex != -1) {
@@ -75,9 +75,8 @@ public final class ResolverHelper {
                     namePattern = namePattern.replaceAll("\\.", "\\\\.");
                     namePattern = 
IvyPatternHelper.substituteToken(namePattern, token, "(.+)");
                     Pattern p = Pattern.compile(namePattern);
-                    for (Iterator iter = all.iterator(); iter.hasNext();) {
-                        String path = (String) iter.next();
-                        Matcher m = p.matcher(path.substring(root.length() + 
1));
+                    for (String path : all) {
+                        Matcher m = p.matcher(path);
                         if (m.matches()) {
                             String value = m.group(1);
                             ret.add(value);
@@ -88,9 +87,6 @@ public final class ResolverHelper {
                 } else {
                     return null;
                 }
-            } catch (IOException e) {
-                Message.verbose("problem while listing resources in " + root + 
" with " + rep, e);
-                return null;
             } catch (Exception e) {
                 Message.warn("problem while listing resources in " + root + " 
with " + rep, e);
                 return null;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java 
b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
index bebd6a7..d37a869 100644
--- 
a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
+++ 
b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
@@ -27,6 +27,7 @@ import junit.framework.TestCase;
 
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
 import org.apache.ivy.util.FileUtil;
 
 public class PomModuleDescriptorWriterTest extends TestCase {
@@ -121,6 +122,20 @@ public class PomModuleDescriptorWriterTest extends 
TestCase {
         assertEquals(expected, wrote);
     }
 
+    public void testTransitive() throws Exception {
+        ModuleDescriptor md = 
ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
+            new IvySettings(), getClass().getResource("test-transitive.xml"), 
false);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
+        assertTrue(_dest.exists());
+
+        String wrote = FileUtil.readEntirely(new BufferedReader(new 
FileReader(_dest)))
+                .replaceAll("\r\n", "\n").replace('\r', '\n');
+        System.out.println(wrote);
+        String expected = 
readEntirely("test-transitive.pom").replaceAll("\r\n", "\n").replace(
+            '\r', '\n');
+        assertEquals(expected, wrote);
+    }
+
     public void testPackaging() throws Exception {
         ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-packaging.pom"), 
false);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.pom 
b/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.pom
new file mode 100644
index 0000000..f4f4949
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.pom
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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 xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>apache</groupId>
+  <artifactId>test-transitive</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0</version>
+  <dependencies>
+    <dependency>
+      <groupId>apache</groupId>
+      <artifactId>ivy</artifactId>
+      <version>1.0</version>
+      <optional>true</optional>
+      <exclusions>
+        <exclusion>
+          <groupId>*</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.xml
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.xml 
b/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.xml
new file mode 100644
index 0000000..9d68c69
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/parser/m2/test-transitive.xml
@@ -0,0 +1,24 @@
+<!--
+   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.    
+-->
+<ivy-module version="1.0">
+    <info organisation="apache" module="test-transitive" revision="1.0"/>
+    <dependencies>
+        <dependency org="apache" name="ivy" rev="1.0" transitive="false" />
+    </dependencies>
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
 
b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
index 1382d8e..b2e56ae 100644
--- 
a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
+++ 
b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
@@ -34,6 +34,8 @@ import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser;
+import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParserTest;
 import org.apache.ivy.util.FileUtil;
 
 public class XmlModuleDescriptorWriterTest extends TestCase {
@@ -138,6 +140,24 @@ public class XmlModuleDescriptorWriterTest extends 
TestCase {
         assertEquals(expected, wrote);
     }
 
+    public void testExtraInfosFromMaven() throws Exception {
+        ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(
+            new IvySettings(),
+            PomModuleDescriptorParserTest.class
+                    .getResource("test-versionPropertyDependencyMgt.pom"), 
false);
+        XmlModuleDescriptorWriter.write(md, LICENSE, dest);
+
+        assertTrue(dest.exists());
+        String wrote = FileUtil.readEntirely(new BufferedReader(new 
FileReader(dest)))
+                .replaceAll("\r\n", "\n").replace('\r', '\n');
+        wrote = wrote.replaceFirst("publication=\"([0-9])*\"", 
"publication=\"20140429153143\"");
+        System.out.println(wrote);
+
+        String expected = 
readEntirely("test-write-extrainfo-from-maven.xml").replaceAll("\r\n",
+            "\n").replace('\r', '\n');
+        assertEquals(expected, wrote);
+    }
+
     public void testExtends() throws Exception {
         ModuleDescriptor md = 
XmlModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(),

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/57892b6e/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-from-maven.xml
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-from-maven.xml
 
b/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-from-maven.xml
new file mode 100644
index 0000000..313d882
--- /dev/null
+++ 
b/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-from-maven.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven";>
+       <info organisation="org.apache"
+               module="test-depMgt"
+               revision="1.0"
+               status="release"
+               publication="20140429153143"
+       >
+               <description homepage="http://ivy.jayasoft.org/"; />
+               
<m:properties__commons.collections.version>1.0.5</m:properties__commons.collections.version>
+               
<m:properties__commons.logging.version>1.0.4</m:properties__commons.logging.version>
+               
<m:dependency.management__commons-logging__commons-logging__version>1.0.4</m:dependency.management__commons-logging__commons-logging__version>
+               
<m:dependency.management__commons-collections__commons-collections__version>1.0.5</m:dependency.management__commons-collections__commons-collections__version>
+               
<m:dependency.management__commons-collections__commons-collections__exclusion_0>javax.mail__mail</m:dependency.management__commons-collections__commons-collections__exclusion_0>
+               
<m:dependency.management__commons-collections__commons-collections__exclusion_1>javax.jms__jms</m:dependency.management__commons-collections__commons-collections__exclusion_1>
+       </info>
+       <configurations>
+               <conf name="default" visibility="public" description="runtime 
dependencies and master artifact can be used with this conf" 
extends="runtime,master"/>
+               <conf name="master" visibility="public" description="contains 
only the artifact published by this module itself, with no transitive 
dependencies"/>
+               <conf name="compile" visibility="public" description="this is 
the default scope, used if none is specified. Compile dependencies are 
available in all classpaths."/>
+               <conf name="provided" visibility="public" description="this is 
much like compile, but indicates you expect the JDK or a container to provide 
it. It is only available on the compilation classpath, and is not transitive."/>
+               <conf name="runtime" visibility="public" description="this 
scope indicates that the dependency is not required for compilation, but is for 
execution. It is in the runtime and test classpaths, but not the compile 
classpath." extends="compile"/>
+               <conf name="test" visibility="private" description="this scope 
indicates that the dependency is not required for normal use of the 
application, and is only available for the test compilation and execution 
phases." extends="runtime"/>
+               <conf name="system" visibility="public" description="this scope 
is similar to provided except that you have to provide the JAR which contains 
it explicitly. The artifact is always available and is not looked up in a 
repository."/>
+               <conf name="sources" visibility="public" description="this 
configuration contains the source artifact of this module, if any."/>
+               <conf name="javadoc" visibility="public" description="this 
configuration contains the javadoc artifact of this module, if any."/>
+               <conf name="optional" visibility="public" description="contains 
all optional dependencies"/>
+       </configurations>
+       <publications>
+               <artifact name="test-depMgt" type="jar" ext="jar" 
conf="master"/>
+       </publications>
+       <dependencies>
+               <dependency org="commons-logging" name="commons-logging" 
rev="1.0.4" force="true" 
conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+               <override org="commons-logging" module="commons-logging" 
matcher="exact" rev="1.0.4"/>
+               <override org="commons-collections" 
module="commons-collections" matcher="exact" rev="1.0.5"/>
+       </dependencies>
+</ivy-module>

Reply via email to