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
Groovy
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
<p>Gram is <table class="wysiwyg-macro" data-macro-name="excerpt" data-macro-parameters="atlassian-macro-output-type=INLINE" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2V4Y2VycHQ6YXRsYXNzaWFuLW1hY3JvLW91dHB1dC10eXBlPUlOTElORX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>a simple xdoclet-like tool for processing doclet tags or Java 5 annotations</p></td></tr></table> in source code or bytecode and auto-generating files, data or resources.</p> <p>Gram = Groovy + <a href="http://annogen.codehaus.org/JAM">JAM</a>. JAM does all the hard work of abstracting away the details between annotations and doclet tags and handling Java 1.4 and 5 compliance. Groovy takes care of the scripting, code generation & templating. Gram is the little tidy bit of code in between.</p> <p>The sources can be found here : <a href="http://svn.groovy.codehaus.org/browse/groovy/trunk/groovy/modules/gram">Gram</a></p> <h2>Using Gram</h2> <p>You can use the Gram class as a main() and run it from your IDE if you wish. There is a GramTask as well for using it inside Ant.</p> <p>Often since JAM depends on Sun's doclet stuff, you can have issues running the GramTask inside Maven and sometimes Ant. So I tend to run the Gram command line tool from inside an Ant build. e.g.</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <java classname="org.codehaus.gram.Gram" fork="true"> <classpath refid="tool.classpath"/> <!-- the directory where the source code lives --> <arg value="src/java"/> <!-- the groovy script to run to generate stuff --> <arg value="src/script/MyGram.groovy"/> </java> </pre></td></tr></table> <h2>Example script</h2> <p>Here's a simple example which just lists all the hibernate peristent classes in your source code</p> <table class="wysiwyg-macro" data-macro-name="unmigrated-inline-wiki-markup" data-macro-parameters="atlassian-macro-output-type=BLOCK" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3VubWlncmF0ZWQtaW5saW5lLXdpa2ktbWFya3VwOmF0bGFzc2lhbi1tYWNyby1vdXRwdXQtdHlwZT1CTE9DS30&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>{snippet:id=gram|lang=java|url=http://svn.codehaus.org/groovy/trunk/groovy/modules/gram/src/script/Dump.groovy}</pre></td></tr></table> <h2>Jar Dependencies</h2> <p>Gram depends on:</p> <ul> <li>The Groovy 'all' jar (groovy-all-*.jar)</li> <li>JAM from the <a href="http://annogen.codehaus.org">Annogen</a> project</li> <li>and potentially: xml-apis.1.02b.jar and Sun's tools.jar</li> </ul> <h2>Articles</h2> <p>You might find some more documentation in the form of blog posts by Andres Almiray:</p> <ul> <li><a href="http://jroller.com/page/aalmiray/?anchor=playing_with_gram">Getting started with Gram</a></li> <li><a href="http://jroller.com/page/aalmiray/?anchor=playing_with_gram_take_2">Going further with Gram</a></li> </ul>
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