Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5845: fix grape, add ivy dependency #5869

Merged
merged 2 commits into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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