[jira] [Commented] (GROOVY-9376) Groovy completely ignores @GrabResolver annotation
[ https://issues.apache.org/jira/browse/GROOVY-9376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17024951#comment-17024951 ] Damian Szuberski commented on GROOVY-9376: -- [~paulk] Thanks for replying to this issue. After some more experimenting I figured things work OK(-ish). In case of missing grapeConfig.xml predefined one is assumed. It contains 2 local caches: Ivy and M2 (which is a very reasonable assumption), then 2 remote repositories: JCenter and Maven Central (in that order), then anything that user specifies as GrabResolver(). This might be little bit counter-intuitive as those 2 public repositories are tried _before_ what user prefers, not as fallback in case all else fails. It might be a problem in corporate scenarios (like mine) where I have internal repos and internal caches of JCenter and Maven Central. Solution would be to ship proper grapeConfig.xml to end user. What I'd suggest (to provide sensible defaults) is changing the order of resolution to: local caches -> GrabResolver() -> JCenter + Maven Central when grapeConfig.xml is missing. Thank you again for taking this issue, looking forward to your reply. {noformat} :: problems summary problems summary :: WARNINGS module not found: org.restlet#org.restlet;6.6.6 cachedGrapes: tried /root/.groovy/grapes/org.restlet/org.restlet/ivy-6.6.6.xml -- artifact org.restlet#org.restlet;6.6.6!org.restlet.jar: /root/.groovy/grapes/org.restlet/org.restlet/jars/org.restlet-6.6.6.jar localm2: tried file:/root//.m2/repository/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.pom -- artifact org.restlet#org.restlet;6.6.6!org.restlet.jar: file:/root//.m2/repository/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.jar jcenter: tried https://jcenter.bintray.com/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.pom -- artifact org.restlet#org.restlet;6.6.6!org.restlet.jar: https://jcenter.bintray.com/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.jar ibiblio: tried https://repo1.maven.org/maven2/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.pom -- artifact org.restlet#org.restlet;6.6.6!org.restlet.jar: https://repo1.maven.org/maven2/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.jar restlet.org: tried http://maven.restlet.org/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.pom -- artifact org.restlet#org.restlet;6.6.6!org.restlet.jar: http://maven.restlet.org/org/restlet/org.restlet/6.6.6/org.restlet-6.6.6.jar{noformat} Full log {code:java} root@df79c73c4c30:~# rm -rf .groovy root@df79c73c4c30:~# cat example.groovy #!/usr/bin/env groovy @GrabResolver(name='restlet.org', root='http://maven.restlet.org') @Grab(group='org.restlet', module='org.restlet', version='6.6.6') import org.restlet.Restlet; root@df79c73c4c30:~# groovy -Dhttps.proxyHost=10.158.100.1 -Dhttps.proxyPort=8080 -Dhttp.proxyHost=10.158.100.1 -Dhttp.proxyPort=8080 -Dgroovy.grape.report.downloads=true -Divy.message.logger.level=4 example.groovy setting 'ivy.default.settings.dir' to 'jar:file:/opt/groovy/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings'setting 'ivy.basedir' to '/root/.'setting 'ivy.default.conf.dir' to 'jar:file:/opt/groovy/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings'setting 'java.runtime.name' to 'OpenJDK Runtime Environment'setting 'sun.boot.library.path' to '/opt/java/openjdk/lib/amd64'setting 'java.vm.version' to '25.232-b09'setting 'groovy.grape.report.downloads' to 'true'setting 'java.vm.vendor' to 'AdoptOpenJDK'setting 'java.vendor.url' to 'http://java.oracle.com/'setting 'path.separator' to ':'setting 'java.vm.name' to 'OpenJDK 64-Bit Server VM'setting 'file.encoding.pkg' to 'sun.io'setting 'user.country' to 'US'setting 'sun.java.launcher' to 'SUN_STANDARD'setting 'sun.os.patch.level' to 'unknown'setting 'program.name' to 'groovy'setting 'java.vm.specification.name' to 'Java Virtual Machine Specification'setting 'user.dir' to '/root'setting 'java.runtime.version' to '1.8.0_232-b09'setting 'java.awt.graphicsenv' to 'sun.awt.X11GraphicsEnvironment'setting 'java.endorsed.dirs' to '/opt/java/openjdk/lib/endorsed'setting 'os.arch' to 'amd64'setting 'java.io.tmpdir' to '/tmp'setting 'line.separator' to ''setting 'java.vm.specification.vendor' to 'Oracle Corporation'setting 'https.proxyHost' to '10.158.100.1'setting 'os.name' to 'Linux'setting 'tools.jar' to '/opt/java/openjdk/lib/tools.jar'setting 'sun.jnu.encoding' to 'UTF-8'setting 'script.name' to '/usr/bin/groovy'setting 'http.proxyPort' to '8080'setting 'java.library.path' to '/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib'setting 'java.specification.name' to 'Java Platform API Specification'setting 'java.class.version' to '52.0'setting 'sun.management.compiler' to 'HotSpot 64-Bit Tiered Compilers'setting 'os.version' to '5.4.0-3-amd64'setting 'user.home' to '/root'
[jira] [Created] (GROOVY-9376) Groovy completely ignores @GrabResolver annotation
Damian Szuberski created GROOVY-9376: Summary: Groovy completely ignores @GrabResolver annotation Key: GROOVY-9376 URL: https://issues.apache.org/jira/browse/GROOVY-9376 Project: Groovy Issue Type: Bug Reporter: Damian Szuberski Steps to reproduce inside docker. Repository added using GrabResolver is completely ignored during resolution and fetching. Manually putting repository location into ~/.groovy/grapeConfig.xml solves the problem and make the custom repository work properly. Tested on Groovy 2.5.x and Groovy 3.x, both have the same issue. This example comes from docker container *groovy:3.0.0-rc-3-jre8* *root@40bc8b504667:~# rm -rf ~/.ivy* ~/.groovy** *root@40bc8b504667:~# cat example.groovy* #!/usr/bin/env groovy @GrabResolver(name='restlet.org', root='[http://maven.restlet.org')|http://maven.restlet.org%27%29/] @Grab(group='org.restlet', module='org.restlet', version='1.1.6') import org.restlet.Restlet; *root@40bc8b504667:~# groovy -Dgroovy.grape.report.downloads=true -Divy.message.logger.level=4 example.groovy* setting 'ivy.default.settings.dir' to 'jar:file:/opt/groovy/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings'setting 'ivy.basedir' to '/root/.'setting 'ivy.default.conf.dir' to 'jar:file:/opt/groovy/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings'setting 'java.runtime.name' to 'OpenJDK Runtime Environment'setting 'sun.boot.library.path' to '/opt/java/openjdk/lib/amd64'setting 'java.vm.version' to '25.232-b09'setting 'groovy.grape.report.downloads' to 'true'setting 'java.vm.vendor' to 'AdoptOpenJDK'setting 'java.vendor.url' to 'http://java.oracle.com/'setting 'path.separator' to ':'setting 'java.vm.name' to 'OpenJDK 64-Bit Server VM'setting 'file.encoding.pkg' to 'sun.io'setting 'user.country' to 'US'setting 'sun.java.launcher' to 'SUN_STANDARD'setting 'sun.os.patch.level' to 'unknown'setting 'program.name' to 'groovy'setting 'java.vm.specification.name' to 'Java Virtual Machine Specification'setting 'user.dir' to '/root'setting 'java.runtime.version' to '1.8.0_232-b09'setting 'java.awt.graphicsenv' to 'sun.awt.X11GraphicsEnvironment'setting 'java.endorsed.dirs' to '/opt/java/openjdk/lib/endorsed'setting 'os.arch' to 'amd64'setting 'java.io.tmpdir' to '/tmp'setting 'line.separator' to ''setting 'java.vm.specification.vendor' to 'Oracle Corporation'setting 'os.name' to 'Linux'setting 'tools.jar' to '/opt/java/openjdk/lib/tools.jar'setting 'sun.jnu.encoding' to 'UTF-8'setting 'script.name' to '/usr/bin/groovy'setting 'java.library.path' to '/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib'setting 'java.specification.name' to 'Java Platform API Specification'setting 'java.class.version' to '52.0'setting 'sun.management.compiler' to 'HotSpot 64-Bit Tiered Compilers'setting 'os.version' to '5.4.0-3-amd64'setting 'user.home' to '/root'setting 'user.timezone' to ''setting 'java.awt.printerjob' to 'sun.print.PSPrinterJob'setting 'file.encoding' to 'UTF-8'setting 'java.specification.version' to '1.8'setting 'java.class.path' to '/opt/groovy/lib/groovy-3.0.0-rc-3.jar'setting 'user.name' to 'root'setting 'ivy.message.logger.level' to '4'setting 'java.vm.specification.version' to '1.8'setting 'sun.java.command' to 'org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --conf /opt/groovy/conf/groovy-starter.conf --classpath . -Dgroovy.grape.report.downloads=true -Divy.message.logger.level=4 example.groovy'setting 'java.home' to '/opt/java/openjdk'setting 'sun.arch.data.model' to '64'setting 'user.language' to 'en'setting 'java.specification.vendor' to 'Oracle Corporation'setting 'awt.toolkit' to 'sun.awt.X11.XToolkit'setting 'java.vm.info' to 'mixed mode'setting 'java.version' to '1.8.0_232'setting 'java.ext.dirs' to '/opt/java/openjdk/lib/ext:/usr/java/packages/lib/ext'setting 'sun.boot.class.path' to '/opt/java/openjdk/lib/resources.jar:/opt/java/openjdk/lib/rt.jar:/opt/java/openjdk/lib/sunrsasign.jar:/opt/java/openjdk/lib/jsse.jar:/opt/java/openjdk/lib/jce.jar:/opt/java/openjdk/lib/charsets.jar:/opt/java/openjdk/lib/jfr.jar:/opt/java/openjdk/classes'setting 'java.vendor' to 'AdoptOpenJDK'setting 'file.separator' to '/'setting 'groovy.jaxb' to 'jaxb'setting 'java.vendor.url.bug' to 'http://bugreport.sun.com/bugreport/'setting 'sun.io.unicode.encoding' to 'UnicodeLittle'setting 'sun.cpu.endian' to 'little'setting 'groovy.starter.conf' to '/opt/groovy/conf/groovy-starter.conf'setting 'groovy.home' to '/opt/groovy'setting 'sun.cpu.isalist' to ''setting 'user.home.url' to 'file:/root/':: loading settings :: url = jar:file:/opt/groovy/lib/groovy-3.0.0-rc-3.jar!/groovy/grape/defaultGrapeConfig.xmlsetting 'ivy.settings.url' to 'jar:file:/opt/groovy/lib/groovy-3.0.0-rc-3.jar!/groovy/grape/defaultGrapeConfig.xml'setting 'ivy.conf.url' to 'jar:file:/opt/groovy/lib/groovy-3.0.0-rc-3.jar!/groo