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

lev*_*ver 0 ssh groovy

当我简单地使用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
Run Code Online (Sandbox Code Playgroud)

有谁见过这个错误?

tim*_*tes 5

这是因为在groovy-ssh中对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"
Run Code Online (Sandbox Code Playgroud)