Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Not A Problem
-
2.3.0-beta-2
-
None
-
None
Description
I cannot use grapes on the command line with the groovy -e feature as documented in my Sept 4 2015 email on the groovy emil list. Subsequent Email conversations on the groovy mailing list with tibokruse@googlemail.com indicate that
(1) The bug is reproducible by Thibault Kruse
(2) It has been fixed by Thibault Kruse
(3) we are waiting for someone to review his code so it can be merged with the mainline and released.
Here is my original email from Sep 4 2015:
The script below works with groovy 2.3.0-beta-2 with the groovy program. I want to move the SQL code to separate text files and execute it from (1) "groovy -e" (2) groovy-console and (3) groovysh.
After looking at http://www.techper.net/2010/04/19/groovy-grape-adding-dependencies-to-root-classloader/ here is my first attempt using Cygwin on windows 8 and groovy that is not working:
groovy -e "import groovy.sql.Sql import groovy.xml.MarkupBuilder; import groovy.sql.Sql def classLoader = this.getClass().getClassLoader(); while (!classLoader.getClass().getName().equals('org.codehaus.groovy.tools.RootLoader')) { classLoader = classLoader.getParent() } groovy.grape.Grape.grab(group:'com.h2database', module:'h2', version:'1.4.188') def sql = Sql.newInstance('jdbc:h2:mem:test_mem', 'sa', '', 'org.h2.Driver');"
Caught: java.lang.ClassNotFoundException: org.h2.Driver
java.lang.ClassNotFoundException: org.h2.Driver
at script_from_command_line.run(script_from_command_line:10)
As you can see, I'm trying to convert the @GrabConfig which does not seem to work with "groovy -e".