You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2017/05/16 20:29:00 UTC

[1/4] ant-ivy git commit: IVY-1531 Fix translation of * for groupid and artifactid, in pom.xml exclusion, for implying transitive=false in ivy

Repository: ant-ivy
Updated Branches:
  refs/heads/master 6973dcbfc -> a3a401027


IVY-1531 Fix translation of * for groupid and artifactid, in pom.xml exclusion, for implying transitive=false in ivy


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

Branch: refs/heads/master
Commit: d19212c03ec7eb82e37e11746bac7a064738b686
Parents: 9967600
Author: Jaikiran Pai <ja...@gmail.com>
Authored: Wed Dec 7 22:13:38 2016 +0530
Committer: Jaikiran Pai <ja...@gmail.com>
Committed: Wed Dec 7 22:50:33 2016 +0530

----------------------------------------------------------------------
 .../parser/m2/PomModuleDescriptorBuilder.java   | 46 ++++++++++++++------
 .../m2/PomModuleDescriptorParserTest.java       | 13 +++++-
 .../ivy/plugins/parser/m2/test-exclusion.pom    | 11 +++++
 3 files changed, 56 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d19212c0/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..5171e7f 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
@@ -290,9 +290,18 @@ public class PomModuleDescriptorBuilder {
         if ((mRevId != null) && mRevId.getModuleId().equals(moduleRevId.getModuleId())) {
             return;
         }
-
+        // experimentation shows the following, excluded modules are
+        // inherited from parent POMs if either of the following is true:
+        // the <exclusions> element is missing or the <exclusions> element
+        // is present, but empty.
+        List<ModuleId> excluded = dep.getExcludedModules();
+        if (excluded.isEmpty()) {
+            excluded = getDependencyMgtExclusions(ivyModuleDescriptor, dep.getGroupId(),
+                    dep.getArtifactId());
+        }
+        final boolean excludeAllTransitiveDeps = shouldExcludeAllTransitiveDeps(excluded);
         DefaultDependencyDescriptor dd = new PomDependencyDescriptor(dep, ivyModuleDescriptor,
-                moduleRevId);
+                moduleRevId, !excludeAllTransitiveDeps);
         scope = (scope == null || scope.length() == 0) ? getDefaultScope(dep) : scope;
         ConfMapper mapping = MAVEN2_CONF_MAPPING.get(scope);
         mapping.addMappingConfs(dd, dep.isOptional());
@@ -327,16 +336,12 @@ public class PomModuleDescriptorBuilder {
             dd.addDependencyArtifact(optionalizedScope, depArtifact);
         }
 
-        // experimentation shows the following, excluded modules are
-        // inherited from parent POMs if either of the following is true:
-        // the <exclusions> element is missing or the <exclusions> element
-        // is present, but empty.
-        List<ModuleId> excluded = dep.getExcludedModules();
-        if (excluded.isEmpty()) {
-            excluded = getDependencyMgtExclusions(ivyModuleDescriptor, dep.getGroupId(),
-                dep.getArtifactId());
-        }
         for (ModuleId excludedModule : excluded) {
+            // This represents exclude all transitive dependencies, which we have already taken
+            // in account while defining the DefaultDependencyDescriptor itself
+            if ("*".equals(excludedModule.getOrganisation()) && "*".equals(excludedModule.getName())) {
+                continue;
+            }
             String[] confs = dd.getModuleConfigurations();
             for (int k = 0; k < confs.length; k++) {
                 dd.addExcludeRule(confs[k], new DefaultExcludeRule(new ArtifactId(excludedModule,
@@ -348,6 +353,21 @@ public class PomModuleDescriptorBuilder {
         ivyModuleDescriptor.addDependency(dd);
     }
 
+    private static boolean shouldExcludeAllTransitiveDeps(final List<ModuleId> exclusions) {
+        if (exclusions == null || exclusions.isEmpty()) {
+            return false;
+        }
+        for (final ModuleId exclusion : exclusions) {
+            if (exclusion == null) {
+                continue;
+            }
+            if ("*".equals(exclusion.getOrganisation()) && "*".equals(exclusion.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public void addDependency(DependencyDescriptor descriptor) {
         // Some POMs depend on themselves through their parent pom, don't add this dependency
         // since Ivy doesn't allow this!
@@ -690,8 +710,8 @@ public class PomModuleDescriptorBuilder {
         private final PomDependencyData pomDependencyData;
 
         private PomDependencyDescriptor(PomDependencyData pomDependencyData,
-                ModuleDescriptor moduleDescriptor, ModuleRevisionId revisionId) {
-            super(moduleDescriptor, revisionId, true, false, true);
+                ModuleDescriptor moduleDescriptor, ModuleRevisionId revisionId, final boolean transitive) {
+            super(moduleDescriptor, revisionId, true, false, transitive);
             this.pomDependencyData = pomDependencyData;
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d19212c0/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..b7c8662 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
@@ -536,7 +536,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
 
         DependencyDescriptor[] dds = md.getDependencies();
         assertNotNull(dds);
-        assertEquals(3, dds.length);
+        assertEquals(4, dds.length);
         assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[0].getDependencyRevisionId());
         assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
@@ -569,6 +569,17 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
             new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
         assertEquals(0, dds[2].getAllExcludeRules().length);
+
+        // test for IVY-1531 (where the pom.xml can have a exclusion for groupid=* and artifactid=*, implying transitive=false, in ivy land)
+        final DependencyDescriptor excludeAllTransitiveDepsDescriptor = dds[3];
+        assertEquals(ModuleRevisionId.newInstance("org.owasp.esapi", "esapi", "2.1.0"), excludeAllTransitiveDepsDescriptor.getDependencyRevisionId());
+        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getModuleConfigurations())));
+        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+                new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
+                new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("runtime"))));
+        assertEquals("No exclusion elements were expected to be present for " + excludeAllTransitiveDepsDescriptor, 0, excludeAllTransitiveDepsDescriptor.getAllExcludeRules().length);
+        assertFalse("Dependency  " + excludeAllTransitiveDepsDescriptor + " was expected to have transitive=false", excludeAllTransitiveDepsDescriptor.isTransitive());
     }
 
     public void testWithPlugins() throws Exception {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d19212c0/test/java/org/apache/ivy/plugins/parser/m2/test-exclusion.pom
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-exclusion.pom b/test/java/org/apache/ivy/plugins/parser/m2/test-exclusion.pom
index 3ec4752..a524ab5 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/test-exclusion.pom
+++ b/test/java/org/apache/ivy/plugins/parser/m2/test-exclusion.pom
@@ -57,5 +57,16 @@
         <exclusion />
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>org.owasp.esapi</groupId>
+      <artifactId>esapi</artifactId>
+      <version>2.1.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>*</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
 </project>


[4/4] ant-ivy git commit: 2016 -> 2017

Posted by hi...@apache.org.
2016 -> 2017


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

Branch: refs/heads/master
Commit: a3a401027abaf26e0d6dd229cdfb2b5a94488f0d
Parents: 2681600
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Tue May 16 20:38:50 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Tue May 16 22:27:16 2017 +0200

----------------------------------------------------------------------
 NOTICE                 | 2 +-
 doc/printTemplate.html | 2 +-
 doc/template.html      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a3a40102/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index d898850..88d0339 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Ivy (TM)
-Copyright 2007-2016 The Apache Software Foundation
+Copyright 2007-2017 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a3a40102/doc/printTemplate.html
----------------------------------------------------------------------
diff --git a/doc/printTemplate.html b/doc/printTemplate.html
index d816f87..fd29b36 100644
--- a/doc/printTemplate.html
+++ b/doc/printTemplate.html
@@ -47,7 +47,7 @@
 
 <div id="footer-message" class="footer">
     <hr />
-    <i>Copyright &#169; 2016 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
+    <i>Copyright &#169; 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
     <i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
     <i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
 </div>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a3a40102/doc/template.html
----------------------------------------------------------------------
diff --git a/doc/template.html b/doc/template.html
index bca509b..f7a4dd1 100644
--- a/doc/template.html
+++ b/doc/template.html
@@ -104,7 +104,7 @@
 
 <div id="footer-message" class="footer">
     <hr />
-    <i>Copyright &#169; 2016 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
+    <i>Copyright &#169; 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
     <i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
     <i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
 </div>


[3/4] ant-ivy git commit: release notes for IVY-1531

Posted by hi...@apache.org.
release notes for IVY-1531


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

Branch: refs/heads/master
Commit: 2681600eca45ee3097bef4f8ff86b1ec5dd24555
Parents: 6b5b674
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Tue May 16 20:36:59 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Tue May 16 22:27:05 2017 +0200

----------------------------------------------------------------------
 doc/release-notes.html | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2681600e/doc/release-notes.html
----------------------------------------------------------------------
diff --git a/doc/release-notes.html b/doc/release-notes.html
index 688d722..bb90c9e 100644
--- a/doc/release-notes.html
+++ b/doc/release-notes.html
@@ -67,6 +67,7 @@ List of changes since Ivy 2.4.0:
 - FIX: dynamic revisions are not cached per resolver (IVY-1430) (Thanks to Stephen Haberman)
 - FIX: Dependencies failed using branch attribute (and extra attributes) (IVY-1141) (Thanks to Stephen Haberman)
 - FIX: useCacheOnly should allow lookup of changing dependencies in cache (IVY-1515) (Thanks to Ilya)
+- FIX: Translation of POM to Ivy XML with * exclusion is removing main artifact (IVY-1531) (Thanks to Jaikiran Pai)
 
 - IMPROVEMENT: Throw an IllegalStateException when retrieving the resolutionCacheRoot on the DefaultResolutionCacheManager if the basedir (or IvySettings) is not set (IVY-1482)
 - IMPROVEMENT: Optimization: limit the revision numbers scanned if revision prefix is specified (Thanks to Ernestas Vaiciukevi&#269;ius)


[2/4] ant-ivy git commit: IVY-1531: Translation of POM to Ivy XML with * exclusion is removing main artifact

Posted by hi...@apache.org.
IVY-1531: Translation of POM to Ivy XML with * exclusion is removing main artifact

This closes #10


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

Branch: refs/heads/master
Commit: 6b5b674cdc4458794d37284de602379f6e0001c7
Parents: 6973dcb d19212c
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Tue May 16 22:26:29 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Tue May 16 22:26:29 2017 +0200

----------------------------------------------------------------------
 .../parser/m2/PomModuleDescriptorBuilder.java   | 46 ++++++++++++++------
 .../m2/PomModuleDescriptorParserTest.java       | 13 +++++-
 .../ivy/plugins/parser/m2/test-exclusion.pom    | 11 +++++
 3 files changed, 56 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/6b5b674c/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/6b5b674c/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
----------------------------------------------------------------------