groovy版本2.3.7在mac上安装了gvm。我们是公司代理的幕后推手,但maven在这里适用于java项目。
尝试以下
groovy groovySSHtest.groovy
内容
@Grab(group='org.hidetake', module='groovy-ssh', version='1.0.1')
import org.hidetake.groovy.ssh.Ssh
def ssh = Ssh.newService()
ssh.remotes {
mylaptop {
host = '127.0.0.1'
user = 'username'
identity = new File('id_rsa')
}
}
ssh.run {
session(ssh.remotes.mylaptop) {
//put 'example.war', '/webapps'
execute 'pwd'
}
}
并收到以下错误
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Error grabbing Grapes -- [download failed: net.java.dev.jna#jna;3.4.0!jna.jar]
java.lang.RuntimeException: Error grabbing Grapes -- [download failed: net.java.dev.jna#jna;3.4.0!jna.jar]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:81)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:421)
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:483)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:166)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:566)
at groovy.grape.GrapeIvy$resolve$3.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:535)
at groovy.grape.GrapeIvy$resolve$2.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:252)
at groovy.grape.Grape.grab(Grape.java:163)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:358)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:319)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:923)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:585)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:286)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:259)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:674)
at groovy.lang.GroovyShell.run(GroovyShell.java:501)
at groovy.lang.GroovyShell.run(GroovyShell.java:491)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:650)
at groovy.ui.GroovyMain.run(GroovyMain.java:381)
at groovy.ui.GroovyMain.process(GroovyMain.java:367)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)
at groovy.ui.GroovyMain.main(GroovyMain.java:106)
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:483)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
1 error
已经尝试过在.m2和.groovy中查找缓存,但一无所获。
尝试设置用户/传递JAVA_OPTS,但没有运气。为常春藤添加了以下调试设置
groovy -Divy.message.logger.level=4 groovySSHtest.groovy
尝试使用代理用户/传递,同样的错误
groovy -Divy.message.logger.level=4 -Dhttp.proxyUser=user -Dhttp.proxyPassword=pass groovySSHtest.groovy
找到了这个附加信息
Module descriptor is processed : net.java.dev.jna#jna;3.4.0
Module descriptor is processed : net.java.dev.jna#platform;3.4.0
storing dependency org.hidetake#groovy-ssh;1.0.1 in props
resolved ivy file produced in cache
:: downloading artifacts ::
[NOT REQUIRED] org.hidetake#groovy-ssh;1.0.1!groovy-ssh.jar
[NOT REQUIRED] org.codehaus.groovy#groovy-all;2.3.6!groovy-all.jar
[NOT REQUIRED] org.slf4j#slf4j-api;1.7.7!slf4j-api.jar
[NOT REQUIRED] com.jcraft#jsch;0.1.51!jsch.jar
[NOT REQUIRED] com.jcraft#jsch.agentproxy.connector- factory;0.0.7!jsch.agentproxy.connector-factory.jar(bundle)
[NOT REQUIRED] com.jcraft#jsch.agentproxy.jsch;0.0.7!jsch.agentproxy.jsch.jar
[NOT REQUIRED] com.jcraft#jsch.agentproxy.core;0.0.7!jsch.agentproxy.core.jar(bundle)
[NOT REQUIRED] com.jcraft#jsch.agentproxy.usocket-jna;0.0.7!jsch.agentproxy.usocket-jna.jar(bundle)
[NOT REQUIRED] com.jcraft#jsch.agentproxy.usocket-nc;0.0.7!jsch.agentproxy.usocket-nc.jar(bundle)
[NOT REQUIRED] com.jcraft#jsch.agentproxy.sshagent;0.0.7!jsch.agentproxy.sshagent.jar(bundle)
[NOT REQUIRED] com.jcraft#jsch.agentproxy.pageant;0.0.7!jsch.agentproxy.pageant.jar(bundle)
trying file:/Users/m673639/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
tried file:/Users/m673639/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
localm2: resource not reachable for net/java/dev/jna#jna;3.4.0: res=file:/Users/m673639/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
WARN: [NOT FOUND ] net.java.dev.jna#jna;3.4.0!jna.jar (1ms)
WARN: ==== localm2: tried
WARN: file:/Users/m673639/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
[NOT REQUIRED] net.java.dev.jna#platform;3.4.0!platform.jar
resolve done (371ms resolve - 7ms download)
:: problems summary ::
:::: WARNINGS
[NOT FOUND ] net.java.dev.jna#jna;3.4.0!jna.jar (1ms)
==== localm2: tried
file:/Users/m673639/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
..当非公司代理网络上的WFH将其作为可能性进行规则时,将尝试此操作。
答案 0 :(得分:0)
这对我有用而不是代理,这表明你需要supply your proxy settings to Groovy。
groovy -Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 groovySSHtest.groovy