diff --git a/doc/contents/GrapeExample.ipynb b/doc/contents/GrapeExample.ipynb new file mode 100644 index 0000000000..ecda68e326 --- /dev/null +++ b/doc/contents/GrapeExample.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "org.codehaus.groovy.control.MultipleCompilationErrorsException", + "evalue": " startup failed", + "output_type": "error", + "traceback": [ + "\u001b[0;31morg.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:", + "\u001b[0;31mscript15033056800541660887958.groovy: 1: unable to resolve class org.apache.commons.io.Charsets", + "\u001b[0;31m @ line 1, column 1.", + "\u001b[0;31m import org.apache.commons.io.Charsets", + "\u001b[0;31m ^", + "\u001b[0;31m", + "\u001b[0;31m1 error", + "\u001b[0;31m", + "\u001b[0;31m\tat com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.run(GroovyCodeRunner.java:57)" + ] + } + ], + "source": [ + "import org.apache.commons.io.Charsets\n", + "println Charsets.US_ASCII " + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "US-ASCII\n" + ] + }, + { + "data": { + "text/plain": [ + "null" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "// https://mvnrepository.com/artifact/commons-io/commons-io\n", + "@Grapes(\n", + " @Grab(group='commons-io', module='commons-io', version='2.5')\n", + ")\n", + "import org.apache.commons.io.Charsets\n", + "println Charsets.US_ASCII " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Groovy", + "language": "groovy", + "name": "groovy" + }, + "language_info": { + "codemirror_mode": "groovy", + "file_extension": ".groovy", + "mimetype": "", + "name": "Groovy", + "nbconverter_exporter": "", + "version": "2.4.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb b/doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb index 75dd6344a7..8918de6746 100644 --- a/doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb +++ b/doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb @@ -14,9 +14,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import com.example.Demo" @@ -32,9 +30,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "%classpath add jar demoResources/demo.jar" @@ -77,9 +73,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import com.example.Demo" @@ -88,9 +82,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import com.example.Demo\n", @@ -140,19 +132,35 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [] - } - ], + "outputs": [], "source": [ "%classpath" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Grapes, Maven, and Ivy\n", + "\n", + "Groovy has a dependency manager called [Grape](http://docs.groovy-lang.org/latest/html/documentation/grape.html) built-in and you can access it as follows. A more powerful classpath magic that works for the rest of the languages is on the [agenda](https://github.com/twosigma/beakerx/issues/5836)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "@Grapes(\n", + " @Grab(group='commons-io', module='commons-io', version='2.5')\n", + ")\n", + "import org.apache.commons.io.Charsets\n", + "println Charsets.US_ASCII" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -211,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": true }, @@ -223,7 +231,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "PI" @@ -275,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "collapsed": true }, diff --git a/kernel/groovy/build.gradle b/kernel/groovy/build.gradle index 82f8bf36b2..d324f115ca 100644 --- a/kernel/groovy/build.gradle +++ b/kernel/groovy/build.gradle @@ -42,6 +42,7 @@ repositories { dependencies { provided project(':base') compile group: "org.codehaus.groovy", name: "groovy-all", version: "2.4.3" + compile group: 'org.apache.ivy', name: 'ivy', version: '2.4.0' compile group: 'org.antlr', name: 'antlr4-runtime', version: '4.5' antlr group: 'org.antlr', name: 'antlr4', version: '4.5'