Hi all

I have a question about running/packaging groovy programs.
I have a small suite of (commandline) NLP tools (
https://github.com/brown-uk/nlp_uk) that is often used by non-developers
(NLP students, researches etc).
When the scripts where simple it was very easy to run them:
1) install groovy
2) git clone/pull
3) then you run scripts from anywhere with simple
..../nlp_uk/src/main/groovy/org/nlp_uk/tools/TagText.groovy -i
input_file.txt

The dependencies are pulled via grape, the command is simple to run and
update.

Now scripts got some common parallelization code and I extracted common
code into TextUtils but to keep things still simple I just use:
  Eval.me(new File("$SCRIPT_DIR/TextUtils.groovy") .....
for a simple "include" hack.

Now one of the scripts got more complicated and more groovy classes needed
and going this approach gets a bit too much for Eval hack.

I looked into alternative approaches, and they all look heavy to me:
1) add fatJar target to build.gradle
a) extra step for the users to build after each update
b) run more complicated command with -cp
c) one of the dependencies I have does not work well with fatJar
(duplicated filepath in different submodules)
2) run commands via gradle, e.g. gradle runToolX -Pargs="..."
a) needs task for each tool (or argument to take which tool to run)
b) needs (ugly) -Pargs to wrap and pass arguments to the command
c) tricky to figure out current dir (although there are some hacks to use
"user.dir" system property)
3) provide shell/bat scripts to wrap things (e.g. -cp etc) for the users
(so far seems the easiest combination for both me to maintain and the users
to use)
a) this incurs groovy compile on all classes for every run (unless in the
shell script I combine gradle compile + run using built classes in the
classpath)
4) use jpackage/jlink
a) again - extra step to build for the users or me publishing official
versions pre-packaged (making it harder to just grab latest version)
b) packaging the whole set of dependencies for each update instead of
reusing grape cache

I would appreciate any suggestions,
Thanks,
Andriy

Reply via email to