gant and groovy ebuild trials and tribulations (long)
Corey <corey_s-r9/[email protected]>
| Newsgroups | gmane.linux.gentoo.java |
|---|---|
| Message-ID | <[email protected]> |
( NOTE: I'm writing this all out, just for the purpose of documentation, and
perhaps some might see/try something that I missed or am unaware of )
#1 - The groovy ebuild really should be installing 'startGroovy'. Even though
gentoo has it's own way of running stuff, via the gjl, startGroovy should
still be be available.
* problem: the 'startGroovy' in the source tarball (groovy-1.0-src.tar.gz)
is totally hosed -- embedded chars or something.
* solution: use the 'startGroovy' from the binary tarball
(groovy-1.0.tar.gz),
which is the exact same file in content -- only it doesn't cause utter
croakage.
Moving on, to the java-experimental gant ebuild:
#1 - The gant ebuild should be doing one of the following:
~ install the 'gant' runner script from the gant distro (which requires
the 'startGroovy' script)
~ install a gentoo java launcher
This is where things start getting a bit crazy.
The following does not work for launching gant:
/usr/bin/gant:
#!/bin/bash
gjl_package=gant
gjl_main="gant.Gant"
source /usr/share/java-config-2/launcher/launcher.bash
... causes:
'Exception in thread "main" java.lang.NoSuchMethodError: main'
After much (MUCH) time and effort, I finally gave up -- going on the
impression
that perhaps the gjl route won't work for groovy classes?? (doesn't seem
right...
a groovy class, when compiled == java class, right?) ( I should be able to
test
this by simply creating a quick groovy class with a main )
SO, after much gnashing of teeth, I took a new tack - to try and just use the
vanilla 'gant' runner from the dist along w/ the standard 'startGroovy' from
my modified groovy ebuild.
... which of course ended up with its own amount of circular run arounds that
I won't go into too much detail suffice to say that the vanilla 'gant' runner
+ 'startGroovy' scripts make assumptions about how things are layed out on the
system which goes against the grain of the gentoo standard layout.
After some time, trying to hammer things together, I figured I'd try again to
get things configured in a more native manner: less straight forward/simple
than that first java launcher which suffered from the NSME exception, but at
least hopefully something that would be pallatable.
... which of course _also_ was the source of much pain. (c8=
Problem #1 was that it needed the groovy-starter.jar , not provided by the
groovy ebuild.
Problem #2 was that launching via GroovyStarter required some trickiness in
getting the java launcher executing correctly, as it was necessary for the
gant dependencies to be attached to the $gjl_pkg_args --classpath.
Problem #3 was that, once I managed to get Problem #2 seemingly fixed, it
turns out a chicken and egg issue cropped up where a strange exception was
being thrown due to what I after much head-banging figured out that it was
a conflict with groovy.jar being in both the $gjl_args as well as the
$gjl_pkg_args, causing:
gjdk.org.codehaus.groovy.tools.RootLoader_GroovyReflector cannot be cast to
org.codehaus.groovy.runtime.Reflector
This was a fun one to track down! (not)
I was able to eventually, and finally, come up with this, which solved the
issue:
#1 - I had to modify the groovy package.env like so:
#CLASSPATH="/usr/share/groovy-1/lib/groovy.jar"
CLASSPATH="/usr/share/groovy-1/lib/groovy.jar:/usr/share/groovy-1/lib/groovy-starter.jar"
#2 - And I had to modify the gant package.env thusly:
#DEPEND="asm-2.2:groovy-1:antlr:commons-cli-1"
DEPEND="asm-2.2:antlr:commons-cli-1:groovy-starter.jar@groovy-1"
#3 - Then for the launcher:
/usr/bin/gant:
#!/bin/bash
gjl_package=gant
gjl_main="org.codehaus.groovy.tools.GroovyStarter"
gjl_pkg_args="--main gant.Gant --classpath $(java-config --classpath
groovy-1,gant,asm-2.2,ant-core,commons-cli-1)"
source /usr/share/java-config-2/launcher/launcher.bash
... which works! I can run gant from gentoo, using the gant and groovy
ebuilds!
After a breather, I'll add the patches to bugzilla - unless I anyone has
comments/suggestions?
(I was also able to make a new ebuild for gant-0.3.1; that was easy at least!)
Beers!
--
[email protected] mailing list