You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2019/11/21 19:49:11 UTC

[groovy] branch GROOVY-9312 created (now 2b08b3b)

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a change to branch GROOVY-9312
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 2b08b3b  GROOVY-9312: disable direct references to local .m2 repo jars

This branch includes the following new commits:

     new 2b08b3b  GROOVY-9312: disable direct references to local .m2 repo jars

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: GROOVY-9312: disable direct references to local .m2 repo jars

Posted by em...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY-9312
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 2b08b3b93235363c84c5f375a8273858d92b1807
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Nov 21 13:48:58 2019 -0600

    GROOVY-9312: disable direct references to local .m2 repo jars
---
 src/resources/groovy/grape/defaultGrapeConfig.xml |  1 -
 src/test/groovy/grape/GrapeIvyTest.groovy         | 61 +++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/src/resources/groovy/grape/defaultGrapeConfig.xml b/src/resources/groovy/grape/defaultGrapeConfig.xml
index 4d17a40..14a180f 100644
--- a/src/resources/groovy/grape/defaultGrapeConfig.xml
+++ b/src/resources/groovy/grape/defaultGrapeConfig.xml
@@ -19,7 +19,6 @@
 
 -->
 <ivysettings>
-  <caches useOrigin="true"/>
   <settings defaultResolver="downloadGrapes"/>
   <resolvers>
     <chain name="downloadGrapes" returnFirst="true">
diff --git a/src/test/groovy/grape/GrapeIvyTest.groovy b/src/test/groovy/grape/GrapeIvyTest.groovy
index 635e5b4..6238857 100644
--- a/src/test/groovy/grape/GrapeIvyTest.groovy
+++ b/src/test/groovy/grape/GrapeIvyTest.groovy
@@ -461,4 +461,65 @@ final class GrapeIvyTest {
 
         Grape.resolve([classLoader:loader], [], [groupId:'org.apache.poi', artifactId:'poi', version:'3.7'])
     }
+
+    @Test // GROOVY-9312
+    void testResolveSucceedsFromLocalMavenRepository() {
+        def tempDir = File.createTempDir()
+
+        new File(tempDir, 'pom.xml').write '''\
+            <?xml version="1.0" encoding="UTF-8"?>
+            <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>org.codehaus.groovy.tests</groupId>
+                <artifactId>maven-bootstrap</artifactId>
+                <version>1.0-SNAPSHOT</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>net.jqwik</groupId>
+                        <artifactId>jqwik</artifactId>
+                        <version>1.2.1</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>net.jqwik</groupId>
+                        <artifactId>jqwik-engine</artifactId>
+                        <version>1.2.1</version>
+                    </dependency>
+                </dependencies>
+            </project>
+        '''.stripIndent()
+
+        try {
+            // prime "${user.home}/.m2/repository" with jqwik
+            assertScript """
+                @Grab('org.apache.maven.shared:maven-invoker:3.0.1')
+                import org.apache.maven.shared.invoker.*
+
+                def request = new DefaultInvocationRequest(goals: ['compile'],
+                    baseDirectory: new File('${tempDir.absolutePath.replace('\\', '\\\\')}'))
+                def result = new DefaultInvoker().execute(request)
+                assert result.exitCode == 0
+            """
+
+            assertScript '''
+                @Grab('net.jqwik:jqwik:1.2.1')
+                import net.jqwik.api.ForAll
+                import net.jqwik.api.Property
+
+                @groovy.transform.CompileStatic
+                class Jsr308 {
+                    @Property
+                    boolean 'size zero or positive'(@ForAll List<Integer> items) {
+                        items.size() >= 0
+                    }
+                }
+
+                println 'success'
+            '''
+        } finally {
+            tempDir.deleteDir()
+        }
+    }
 }