|
RE: Ant and Groovy integration (Gravy): msg#00157lang.groovy.user
Hi Scott, thanx for your post! This is very useful for me. cheers Mittie > -----Original Message----- > From: Scott Stirling [mailto:scottstirling-KealBaEQdz4@xxxxxxxxxxxxxxxx] > Sent: Montag, 22. November 2004 20:13 > To: dev-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx; > user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx > Subject: [groovy-user] Ant and Groovy integration (Gravy) > > > Hi, > > Here's a little hack that I think represents a stabler pattern > for integrating > Ant and Groovy at the infrastructural layer. > > Problem: > - Groovy bundles some Ant jars and loads them in classloader A > - Many real Ant builds use different versions of Ant and/or 3rd > party Ant tasks > such as XDoclet, XMLTask, PMD, JUnit, Beanshell scripts, etc., > which are often > installed in ANT_HOME/lib or are referenced in build script classpaths. > - Adding 3rd party jars for Ant builds to the Groovy classpath > using the -cp or > -classpath options on the command line causes conflicts because of the > classloader hierarchy > - Groovy currently ships minimal Ant 1.6.1 jars and JUnit's jar > for the Ant > junit task, but this is ad hoc and arbitrary and leave Ant and > JUnit version > upgrade issues unanswered. > - Groovy's AntBuilder needs minimal Ant jars to work at all with > built-in tasks > > Solution: > - Define clear integration points to decouple Groovy and Ant > - use groovy-classworlds.conf to put ANT_HOME/lib first in the > Groovy classpath. > > Advantages: > - allows me to use Groovy to execute a whole bunch of existing > build scripts I > have with no changes > - allows me to re-use existing Ant installation infrastructure we > have on every > desktop or in every project in source control > - minimal changes to Groovy scripts/config > > Check it out: > > Change to $GROOVY_HOME/conf/groovy-classworlds.conf > # NEW: Load all libs under ANT_HOME first > load ${ant.home}/lib/* > > # Load required libraries > load ${groovy.home}/lib/*.jar > > > Then in the bin/groovy script, I added a -D to set ant.home to ANT_HOME: > exec $JAVACMD $JAVA_OPTS \ > -classpath "$CP" \ > -Dprogram.name="$PROGNAME" \ > -Dclassworlds.conf="$CLASSWORLDS_CONF" \ > -Dgroovy.home="$GROOVY_HOME" \ > -Dant.home="$ANT_HOME" \ <-- NEW > -Dtools.jar="$TOOLS_JAR" \ > org.codehaus.classworlds.Launcher "$@" > > Hope someone finds this useful. I've got some more stuff to share > soon, but need > to vet it out a bit here first. > > Thanks, > Scott Stirling > Framingham, MA >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: MarkupBuilder combining attributes and content, Scott Stirling |
|---|---|
| Next by Date: | No anonymous inner classes?, Dusty Phillips |
| Previous by Thread: | Ant and Groovy integration (Gravy), Scott Stirling |
| Next by Thread: | Doubt about Groovy Docs, Cleverton Hentz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |