Skip to content

Commit

Permalink
#5845: fix grape, add ivy dependency (#5869)
Browse files Browse the repository at this point in the history
* #5845: fix grape, add ivy dependency

* add grapes to classpath doc
  • Loading branch information
jaroslawmalekcodete authored and scottdraves committed Aug 21, 2017
1 parent d2e3584 commit d382bdc
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 23 deletions.
89 changes: 89 additions & 0 deletions doc/contents/GrapeExample.ipynb
Original file line number Diff line number Diff line change
@@ -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
}
56 changes: 33 additions & 23 deletions doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import com.example.Demo"
Expand All @@ -32,9 +30,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%classpath add jar demoResources/demo.jar"
Expand Down Expand Up @@ -77,9 +73,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import com.example.Demo"
Expand All @@ -88,9 +82,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import com.example.Demo\n",
Expand Down Expand Up @@ -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": {},
Expand Down Expand Up @@ -211,7 +219,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -223,7 +231,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"PI"
Expand Down Expand Up @@ -275,7 +285,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand Down
1 change: 1 addition & 0 deletions kernel/groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit d382bdc

Please sign in to comment.