3

I have a new groovy installation and i am trying to execute a simple groovy script

 // Test.Groovy
 @Grab('commons-io:commons-io:1.2')
 import org.apache.commons.io.CopyUtils
  println "Resolved!"

But i get the below error , even after creating a dummy grapeConfig.xml and cleaning the .groovy folder, there is no .m2 folder in my repository to clean nor the .ivy

 /opt/groovy-2.4.13/bin [52]$ groovy ~/temp/Test.groovy
 Picked up _JAVA_OPTIONS: -Xmx4g -XX:ParallelGCThreads=2
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Error grabbing Grapes -- [unresolved dependency: commons-io#commons-io;1.2: not found]

java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: commons-io#commons-io;1.2: not found]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

When i try to manually install the dependency using below command i get

grape install -V common-cli commons-cli 1.2
 Picked up _JAVA_OPTIONS: -Xmx4g -XX:ParallelGCThreads=2
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
  Caused by: groovy.lang.MissingMethodException: No signature of method: groovyjarjarcommonscli.Options.getOptionProperties() is applicable for argument types: (java.lang.String) values: [D]
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)

I have no more option to move forward.

M. Justin
  • 14,487
  • 7
  • 91
  • 130
DevOops
  • 276
  • 2
  • 8
  • 20
  • Have you tried using more recent version of `commons-io`, e.g. `@Grab(group='commons-io', module='commons-io', version='2.6')` ? Version 1.2 is something like 12 years old – Szymon Stepniak Feb 13 '18 at 23:23
  • irrespective of what version what artifact i try to donwload , i throws me the same error – DevOops Feb 14 '18 at 00:04
  • As per the link https://github.com/groovy/docker-groovy/issues/24 and http://mail-archives.apache.org/mod_mbox/groovy-notifications/201801.mbox/%3CJIRA.13129544.1515509397000.612991.1515539341153@Atlassian.JIRA%3E it looks like its the issue with groovy 2.4.13 , i will try upgrading to 2.5 or 2.4.14 and update – DevOops Feb 14 '18 at 03:19
  • Nice catch :) You can also try downgrading to 2.4.12 - I use it on my laptop and I don't have any problems with Grapes – Szymon Stepniak Feb 14 '18 at 08:22
  • Sure, will try that Thank you :) – DevOops Feb 14 '18 at 16:17
  • 1
    It worked with 2.4.12 and after adding "https" proxy settings along with "http" – DevOops Feb 14 '18 at 17:29

0 Answers0