我有一个新的groovy安装,我正在尝试执行一个简单的groovy脚本
// Test.Groovy
@Grab('commons-io:commons-io:1.2')
import org.apache.commons.io.CopyUtils
println "Resolved!"
但我得到以下错误,即使在创建虚拟grapeConfig.xml并清理.groovy文件夹之后,我的存储库中也没有.m2文件夹可以清理.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)
当我尝试使用以下命令手动安装依赖项时,我得
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)
我没有其他选择继续前进。