Apache Zeppelin:如何管理 groovy 解释器的依赖关系

Apache Zeppelin: How to manage dependencies for groovy interpreter

我用过Apache Zeppelin 0.8.1.

我想要用户 Groovy interpreter. And use @Grape 部门管理:

%groovy

@Grapes([
    @Grab('com.github.twosigma.beakerx:beaker-kernel-groovy:0.9.0')
])
import com.twosigma.beakerx.widget.IntSlider

但出现错误:

java.lang.RuntimeException: Failed to parse groovy script: java.lang.NoClassDefFoundError: org/apache/ivy/Ivy
 at org.apache.zeppelin.groovy.GroovyInterpreter.getGroovyScript(GroovyInterpreter.java:140)

合理。通过 Dependency Management for Interpreter 的官方文档,我提供了工件 dep:org.apache.ivy:ivy:2.5.0-rc1

在存储库中,我启用了 Central (http://repo1.maven.org/maven2/),其中包含该工件:

但是在解释器重新启动和笔记本重新加载时我得到了错误:Error setting properties for interpreter 'groovy.groovy': Cannot fetch dependencies for org.apache.ivy:ivy:2.5.0-rc1

我试过(作为实验,不是长期解决方案)进入 zeppelin docker container 并将 http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.5.0-rc1/ivy-2.5.0-rc1.jar 下载到 /zeppelin/interpreter/groovy,重新启动解释器,重新加载笔记本,它看起来像 groovy 尝试解决问题 - 我第二次看到进度条,但随后又出现错误:

java.lang.RuntimeException: Failed to parse groovy script: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during conversion: Error grabbing Grapes -- [unresolved dependency: com.github.twosigma.beakerx#beaker-kernel-groovy;0.9.0: not found] java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: com.github.twosigma.beakerx#beaker-kernel-groovy;0.9.0: not found] 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:423) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:426) 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:498) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:169) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154) at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:573) at groovy.grape.GrapeIvy$resolve.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190) at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:540) at groovy.grape.GrapeIvy$resolve[=13=].callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182) at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:258) at groovy.grape.Grape.grab(Grape.java:167) at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:378) at org.codehaus.groovy.transform.ASTTransformationVisitor.call(ASTTransformationVisitor.java:321) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at groovy.lang.GroovyShell.parse(GroovyShell.java:736) at org.apache.zeppelin.groovy.GroovyInterpreter.getGroovyScript(GroovyInterpreter.java:133) at org.apache.zeppelin.groovy.GroovyInterpreter.interpret(GroovyInterpreter.java:155) at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:103) at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:632) at org.apache.zeppelin.scheduler.Job.run(Job.java:188) at org.apache.zeppelin.scheduler.ParallelScheduler$JobRunner.run(ParallelScheduler.java:162) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 1 error at org.apache.zeppelin.groovy.GroovyInterpreter.getGroovyScript(GroovyInterpreter.java:140)

看起来 groovy 没有看到存储库配置并尝试仅在本地解决依赖关系。

我应该设置什么来改变它?

zeppelin 中的

groovy 不支持 @Grab

您的工件存在于特定存储库中

http://maven.imagej.net/content/repositories/public/

检查这个神器搜索引擎:

https://mvnrepository.com/artifact/com.github.twosigma.beakerx/beaker-kernel-groovy/0.9.0

所以,只需向 zeppelin 添加一个新的 repo

UPD:

对于org.apache.ivy:ivy:2.5.0-rc1,下载了很多依赖项 其中一个失败了。这是我在控制台中看到的内容:

Error while downloading repos for interpreter group : groovy, 
    go to interpreter setting page click on edit and save it again 
    to make this interpreter work properly: 
         Cannot fetch dependencies for org.apache.ivy:ivy:2.5.0-rc1 
    ...
Caused by: org.sonatype.aether.resolution.DependencyResolutionException:
    Could not find artifact com.jcraft:jsch.agentproxy:jar:0.0.9 in central
    (http://repo1.maven.org/maven2/)
   ...

(IHMO 这是齐柏林飞艇的一个错误)

但要使其正常工作

artifact= org.apache.ivy:ivy:2.4.0
exclude=  com.jcraft:jsch.agentproxy