Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Gant
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h4> Gant 1.9.9 released, 2013-01-28 20:20:00</h4><h1>Gant is Groovy Ant Scripting</h1><p>Gant is a tool for scripting Ant tasks using Groovy instead of XML to specify the logic. A Gant specification is a Groovy script and so can bring all the power of Groovy to bear directly, something not possible with Ant scripts. Whilst it might be seen as a competitor to Ant, Gant uses Ant tasks for many of the actions, so Gant is really an alternative way of doing things using Ant, but using a programming language rather than XML to specify the rules.<br /> Here is an example Gant script:</p><table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>includeTargets << gant.targets.Clean cleanPattern << ['**/*~', '**/*.bak'] cleanDirectory << 'build' target(stuff: 'A target to do some stuff.') { println 'Stuff' depends clean echo message: 'A default message from Ant.' otherStuff() } target(otherStuff: 'A target to do some other stuff') { println 'OtherStuff' echo message: 'Another message from Ant.' clean() } setDefaultTarget stuff </pre></td></tr></table><p>In this script there are two targets, stuff and otherStuff -- the default target for this build is designated as stuff and is the target run when Gant is executed from the command line with no target as parameter.</p><p>Targets are closures so they can be called as functions, in which case they are executed as you expect, or they can be dependencies to other targets by being parameters to the depends function, in which case they are executed if an only if they have not been executed already in this run. (There is a page with some more information on <a class="confluence-link" href="/display/GANT/Targets" data-linked-resource-id="24248326" data-linked-resource-type="page" data-linked-resource-default-alias="Targets" data-base-url="http://docs.codehaus.org">Targets</a>.)</p><p>You may be wondering about the stuff at the beginning of the script. Gant has two ways of using pre-built sub-scripts, either textual inclusion of another Gant script or the inclusion of a pre-compiled class. The example here shows the latter -- the class gant.targets.Clean is a class that provides simple clean capabilities.</p><p>The default name for the Gant script is build.<strong>gant</strong>, in the same way that the default for an Ant script in build.xml.</p><p>Gant provides a way of finding what the documented targets are:</p><table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>| > gant -p clean Action the cleaning. clobber Action the clobbering. Do the cleaning first. otherStuff A target to do some other stuff stuff A target to do some stuff. Default target is stuff. | > </pre></td></tr></table><p>The messages on this output are exactly the strings associated with the target name in the introduction to the target.</p><h2>Gant "can eat its own dog food"</h2><p>Gant used to be used for building and installing itself and is being used for various build tasks including building Groovy and Java programs, static websites, LaTeX documents, not to mention being an integral part of <a href="http://www.grails.org">Grails</a>. The ability to have arbitrary Groovy methods within the scripts makes Gant so much easier to work with that the mix of XML and Groovy scripts that using Ant necessitates. But then maybe this is an issue of individual perception.</p><h2>Gant isn't really a "build framework"</h2><p>Gant is just a lightweight façade on Groovy's AntBuilder. It just a way of scripting Ant tasks using Groovy. Gant can be used to do build tasks, but it doesn't have the integrated artefact dependency management, project lifecycle management, and multi-module/sub-project support that a fully fledged build framework should provide. <a href="http://www.gradle.org">Gradle</a> on the other hand is a complete build framework based on Groovy and Ivy. If you just want to do some Ant task scripting then Gant is probably the tool you need, but for replacing Ant and Maven as build frameworks (so as to get rid of all the XML and use Groovy), then you probably need to consider <a href="http://www.gradle.org">Gradle</a>.</p><p>And yes, Gant is managed by a <a href="http://www.gradle.org">Gradle</a> build.</p><p>It is probably worth noting that <a href="http://www.gradle.org">Gradle</a> grew out of work done on Gant.</p><h2>Getting Gant</h2><p><a class="confluence-link" href="/display/GANT/Prepackaged+Distributions" data-linked-resource-id="112492579" data-linked-resource-type="page" data-linked-resource-default-alias="Prepackaged Distributions" data-base-url="http://docs.codehaus.org">Prepackaged Distributions</a> are for those who want to "load and go".</p><p><a class="confluence-link" href="/display/GANT/Developer+Access" data-linked-resource-id="112492583" data-linked-resource-type="page" data-linked-resource-default-alias="Developer Access" data-base-url="http://docs.codehaus.org">Developer Access</a> is for those who want to be right on the cutting edge.</p><h2>Endnote</h2><p>If you give Gant a go and have some feedback, do let us know on the Gant User mailing list or perhaps the Groovy User mailing list.</p><p>BTW Gant is not a toy, it is used for task management in <a href="http://www.grails.org">Grails</a>! In fact there is a very nice <a href="http://docs.codehaus.org/display/GRAILS/Command+Line+Scripting">page on the Grails site</a> showing how Gant scripts can be used in Grails.</p><p>If you have any issues with Gant then please add a JIRA issue into the Gant JIRA at Codehaus. The URL is <a href="http://jira.codehaus.org/secure/CreateIssue!default.jspa">http://jira.codehaus.org/secure/CreateIssue!default.jspa|http://jira.codehaus.org/secure/CreateIssue!default.jspa</a></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced