Message-ID: <1098084784.10107.1419289267806.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10106_567250431.1419289267806" ------=_Part_10106_567250431.1419289267806 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
One of the first questions I face when I start playing with a ne= w language, is about how to set a project using this language so that I can= build and package my code. While learning how to do this with Groovy I end= ed up putting together a starter project that has a reusable build script a= nd runner class that allows me to quickly get a new Groovy project up and r= unning.=20
Groovy Quick Start is meant to help developers new to groovy to get star= ted by providing a way to have a groovy project up and running with a minim= um effort. It provides a default layout and a reusable gant script that kno= ws how to compile, test and package your project out of the box.=20
Compiling your project=20
prompt> gant compile=20
This target knows how to compile any source files that are available in = the default source location. If you execute this target out of the box shou= ld report the succesful creation of the required build output folders and t= he compilation of one sample java class and two sample groovy classes= =20
Testing your project=20
prompt> gant test=20
The test target will compile the source code in the src and test_src fol=
ders, and then it will execute the unit tests located in the tests_src fold=
er. When you run this target out of the box it will succesfully report the =
execution of two sample test classes
Preparing t= o distribute your project
prompt> gant distro=20
the distro target will create a distribution folder in your build_output=
folder. This dist folder will contain a lib folder with all the jars from =
the project lib folder, as well as the contents of the src folder packaged =
as a jar. Also in the dist folder is your README.txt file and a bin folder =
that contains the sample batch file provided with the project. To test the =
distribution you can cd into your
%path%\groovyquickstart\build_outpu= t\dist\bin and run the file "run.bat". This launch script will pr= int the help message:
usage: runner [option]
"-h" hel= p &n= bsp;  = ; Print out this message containing help.
&q= uot;-n" name <name to greet> The name of the = user to be greeted.
"-r" run = ; &n= bsp;  = ; Runs some target.
"-v"&nbs= p; version  = ; P= rint version information.
To test the sample commands in the Runner class, enter the command
prompt> Hello from the starter class foo
This sample Runner class demonstrates how to use the CLI builder to read= parameters from the command line and to execute a class in the proje= ct, based on those parameters.=20
Packaging your project=20
prompt> gant package=20
This target will create a zip file with the content of your dist folder =
When you use the default fol= ders for your project artifacts the gant script should work without modific= ations, If you feel that you need to add or improve your build steps just m= odify the gant build script to suit your needs.
= Eclipse Support
The GroovyQuickStart can be imported into Ec= lipse, once you use the Eclipse import facilities you will need to update t= he project build dependencies to point to the correct location of the Groov= y libraries.
For more information review the readme file located in the "groovyq= uickstart\docs" folder=20
I hope you can take advantage of Groovy Quick Start P= roject to get started on your groovy project and please feel free to contac= t me with any questions at email@example.com
An example 'run' script to test the distribution: run=20
Use that instead of the 'run.bat' that comes packaged in the groovyquick= start.zip .=20
It appears the original blog/site went down, the zip file is now attache=
My blog was out of comission for a while , but I am working on updating = this project to use the new joint compiler, in the meantime here is a new z= ip file containing the run file for linux groovyquickstart1.zip