Closed hutcj closed 4 years ago
I don't have the answer for your specific question, that's more on the Groovy side. But I fell into a similar problem, which lead me to create this JAR file: https://github.com/Riverside-Software/groovy-pct Basically Groovy + Ant + PCT in a single JAR file
Thanks for sharing that. Wouldn't you still need to have a standard Groovy installation available to have access to groovy, groovyc, etc.? Or is this meant more for runtime of precompiled Groovy scripts? But then wouldn't you still need the groovy command to run a compiled Groovy class? How exactly do you use this? Would I throw it into $DLC/ant/lib or $DLC/java somewhere?
The way I'm using is for deployment (or db upgrade) where there's some logic to be applied. I usually deploy a set of Groovy scripts (in the form of .groovy files), this JAR file, and I use the JRE coming with Progress (or the external one starting from 12.2).
Works great!
$ $DLC/jre/bin/java -jar ~/Downloads/groovy-ant.jar test.groovy
[PCTVersion] PCT Version : pct-209-master-260e0a7951e4a94d04f43fc827196578e664bebb
Looks like more recent versions of Groovy like 2.5.12 don't have the embeddable folder or any "groovy-all...jar" file. Would I just have to add a
E.g.
$ ls -al groovy/groovy-2.5.12/
total 48
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 ./
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 ../
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 bin/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 conf/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 grooid/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 indy/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 lib/
-rw-r--r-- 1 hutcj 1049089 14503 May 18 20:18 LICENSE
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 licenses/
-rw-r--r-- 1 hutcj 1049089 1308 May 18 20:18 NOTICE
$ ls -al groovy/groovy-2.5.12/indy
total 8588
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 ./
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:04 ../
-rw-r--r-- 1 hutcj 1049089 5626612 May 18 20:21 groovy-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 69752 May 18 20:20 groovy-ant-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 7563 May 18 20:19 groovy-bsf-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 71221 May 18 20:20 groovy-cli-commons-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 60339 May 18 20:19 groovy-cli-picocli-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 747418 May 18 20:20 groovy-console-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 14798 May 18 20:19 groovy-datetime-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 7413 May 18 20:20 groovy-dateutil-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 124320 May 18 20:20 groovy-docgenerator-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 138133 May 18 20:20 groovy-groovydoc-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 449668 May 18 20:20 groovy-groovysh-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 3613 May 18 20:20 groovy-jaxb-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 130249 May 18 20:20 groovy-jmx-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 128620 May 18 20:20 groovy-json-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 5149 May 18 20:20 groovy-json-direct-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 17320 May 18 20:20 groovy-jsr223-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 234661 May 18 20:20 groovy-macro-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 15516 May 18 20:20 groovy-nio-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 22481 May 18 20:20 groovy-servlet-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 79809 May 18 20:20 groovy-sql-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 369566 May 18 20:20 groovy-swing-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 97057 May 18 20:20 groovy-templates-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 80651 May 18 20:20 groovy-test-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 9238 May 18 20:20 groovy-test-junit5-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 5489 May 18 20:20 groovy-testng-2.5.12-indy.jar
-rw-r--r-- 1 hutcj 1049089 218416 May 18 20:20 groovy-xml-2.5.12-indy.jar
Versus the old version:
$ ls -al groovy/groovy-2.4.15/
total 44
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 ./
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 ../
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 bin/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 conf/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 embeddable/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 grooid/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 indy/
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 lib/
-rw-r--r-- 1 hutcj 1049089 14338 Mar 23 2018 LICENSE
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 licenses/
-rw-r--r-- 1 hutcj 1049089 1175 Mar 23 2018 NOTICE
$ ls -al groovy/groovy-2.4.15/embeddable/
total 13808
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 ./
drwxr-xr-x 1 hutcj 1049089 0 Jun 11 16:05 ../
-rw-r--r-- 1 hutcj 1049089 7164868 Mar 23 2018 groovy-all-2.4.15.jar
-rw-r--r-- 1 hutcj 1049089 6966215 Mar 23 2018 groovy-all-2.4.15-indy.jar
I guess this was a decision by the Groovy developers. Don't fully understand the reason they no longer include it, but appears to have caused some issues in the past. https://issues.apache.org/jira/browse/GROOVY-8751
I'll have to do some more reading on how to build the jar file myself.
Looks like more recent versions of Groovy like 2.5.12 don't have the embeddable folder or any "groovy-all...jar" file. Would I just have to add a task for each jar in the indy folder instead?
I'm still using Groovy 2.4 for this reason :-) I never took time to create the fatjar for newer versions of Groovy, but it's on my TODO list. Feel free to open a pull request if you do it before me !
Gotcha, thanks!
Using PCT with Groovy on Windows
With proant, I don't have to manually specify the path to the PCT.jar in order for the PCT definitions to be loaded. However, when using Groovy, I do have to path it out manually. Is there an environment variable that I'm missing? I compared this setup to my setup on a UNIX machine and didn't find anything different, yet on that machine I can use Groovy without manual pathing.
Your environment
Actual behaviour
Using proant
build.xml:
Result:
Using Groovy with manual pathing:
test.groovy:
Result:
Using Groovy without manual pathing:
test.groovy:
Result:
Expected behaviour
Groovy should not have to manually path to the PCT jar.
Steps to reproduce
Run test.groovy on Windows to execute PCT tasks without specifying the exact location of PCT.jar.