尝试使用Grape抓取groovy-ssh插件时抛出ClassNotFoundException

时间:2016-03-16 16:44:28

标签: groovy ssh

当我简单地使用Grape抓取groovy-ssh插件时,会抛出异常。我使用此处的代码:https://github.com/int128/groovy-ssh

@Grab('org.hidetake:groovy-ssh:1.5.0')
@Grab('ch.qos.logback:logback-classic:1.1.2')
def ssh = org.hidetake.groovy.ssh.Ssh.newService()
println "Test"

BUG! exception in phase 'conversion' in source unit 'delete.groovy' # Licensed to the Apache Software Foundation (ASF) under one or more
Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more

有人看到过这个错误吗?

1 个答案:

答案 0 :(得分:5)

这是因为groovy-ssh中的transitive dependency on groovy-all

修复:

@Grab('org.hidetake:groovy-ssh:1.4.0')
@GrabExclude('org.codehaus.groovy:groovy-all')
@Grab('ch.qos.logback:logback-classic:1.1.2')
def ssh = org.hidetake.groovy.ssh.Ssh.newService()
println "Test"