You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2015/10/28 19:54:05 UTC

[1/2] incubator-groovy git commit: GROOVY-7649: Grape.resolve() always fails after first unresolved dependency

Repository: incubator-groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 783d9b6d1 -> 2246ee2d4


GROOVY-7649: Grape.resolve() always fails after first unresolved dependency

add test


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/2246ee2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/2246ee2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/2246ee2d

Branch: refs/heads/GROOVY_2_4_X
Commit: 2246ee2d436f1dcb1607757a4c9b7317f9ea32d8
Parents: 76e9104
Author: pascalschumacher <pa...@gmx.net>
Authored: Wed Oct 28 19:51:00 2015 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Wed Oct 28 19:53:48 2015 +0100

----------------------------------------------------------------------
 src/test/groovy/grape/GrapeIvyTest.groovy | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/2246ee2d/src/test/groovy/grape/GrapeIvyTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/grape/GrapeIvyTest.groovy b/src/test/groovy/grape/GrapeIvyTest.groovy
index 10bb4f8..bd33870 100644
--- a/src/test/groovy/grape/GrapeIvyTest.groovy
+++ b/src/test/groovy/grape/GrapeIvyTest.groovy
@@ -420,4 +420,15 @@ class GrapeIvyTest extends CompilableTestSupport {
         '''
         assert System.getProperty('groovy7548prop') == 'y'
     }
+
+    @Test // GROOVY-7649
+    void testResolveSucceedsAfterFailure() {
+        GroovyClassLoader loader = new GroovyClassLoader()
+
+        shouldFail{
+            Grape.resolve([classLoader:loader], [], [groupId:'bogus', artifactId:'bogus', version:'0.1'])
+        }
+
+        Grape.resolve([classLoader:loader], [], [groupId:'org.apache.poi', artifactId:'poi', version:'3.7'])
+    }
 }


[2/2] incubator-groovy git commit: GROOVY-7649: Grape.resolve() always fails after first unresolved dependency (closes #164)

Posted by pa...@apache.org.
GROOVY-7649: Grape.resolve() always fails after first unresolved dependency (closes #164)

clean up current dependencies state when resolve fails


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/76e9104f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/76e9104f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/76e9104f

Branch: refs/heads/GROOVY_2_4_X
Commit: 76e9104ff1413a221985e8550df0e35d8a7cc993
Parents: 783d9b6
Author: Jason Plurad <pl...@apache.org>
Authored: Wed Oct 28 06:17:22 2015 -0700
Committer: pascalschumacher <pa...@gmx.net>
Committed: Wed Oct 28 19:53:48 2015 +0100

----------------------------------------------------------------------
 src/main/groovy/grape/GrapeIvy.groovy | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/76e9104f/src/main/groovy/grape/GrapeIvy.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/grape/GrapeIvy.groovy b/src/main/groovy/grape/GrapeIvy.groovy
index ef12154..d5ada65 100644
--- a/src/main/groovy/grape/GrapeIvy.groovy
+++ b/src/main/groovy/grape/GrapeIvy.groovy
@@ -564,7 +564,15 @@ class GrapeIvy implements GrapeEngine {
         // err on the side of using the class already loaded into the
         // classloader rather than adding another jar of the same module
         // with a different version
-        ResolveReport report = getDependencies(args, *localDeps.asList().reverse())
+        ResolveReport report = null
+        try {
+            report = getDependencies(args, *localDeps.asList().reverse())
+        } catch (Exception e) {
+            // clean-up the state first
+            localDeps.removeAll(grabRecordsForCurrDependencies)
+            grabRecordsForCurrDependencies.clear()
+            throw e
+        }
 
         List<URI> results = []
         for (ArtifactDownloadReport adl in report.allArtifactsReports) {