| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| <head> |
| <!-- Matomo --> |
| <script> |
| var _paq = window._paq = window._paq || []; |
| /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ |
| _paq.push(["setDoNotTrack", true]); |
| _paq.push(["disableCookies"]); |
| _paq.push(['trackPageView']); |
| _paq.push(['enableLinkTracking']); |
| (function() { |
| var u="https://analytics.apache.org/"; |
| _paq.push(['setTrackerUrl', u+'matomo.php']); |
| _paq.push(['setSiteId', '79']); |
| var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; |
| g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); |
| })(); |
| </script> |
| <!-- End Matomo Code --> |
| <title>5 The Command Line 2.1.5</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| <link rel="stylesheet" href="../css/main.css" type="text/css" media="screen, print" title="Style" charset="utf-8"/> |
| <link rel="stylesheet" href="../css/pdf.css" type="text/css" media="print" title="PDF" charset="utf-8"/> |
| <script type="text/javascript"> |
| function addJsClass() { |
| var classes = document.body.className.split(" "); |
| classes.push("js"); |
| document.body.className = classes.join(" "); |
| } |
| </script> |
| </head> |
| |
| <body class="body" onload="addJsClass();"> |
| <div id="navigation"> |
| <ul> |
| <li> |
| <div id="nav-summary" onmouseover="toggleNavSummary(false)" onmouseout="toggleNavSummary(true)"> |
| <a href="../guide/index.html" class="button">Table of contents</a> |
| |
| <div id="nav-summary-childs" style="display:none;"> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/introduction.html"><strong>1</strong><span>Introduction</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/gettingStarted.html"><strong>2</strong><span>Getting Started</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/upgradingFromPreviousVersionsOfGrails.html"><strong>3</strong><span>Upgrading from previous versions of Grails</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/conf.html"><strong>4</strong><span>Configuration</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/commandLine.html"><strong>5</strong><span>The Command Line</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/GORM.html"><strong>6</strong><span>Object Relational Mapping (GORM)</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/theWebLayer.html"><strong>7</strong><span>The Web Layer</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/validation.html"><strong>8</strong><span>Validation</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/services.html"><strong>9</strong><span>The Service Layer</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/testing.html"><strong>10</strong><span>Testing</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/i18n.html"><strong>11</strong><span>Internationalization</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/security.html"><strong>12</strong><span>Security</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/plugins.html"><strong>13</strong><span>Plugins</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/webServices.html"><strong>14</strong><span>Web Services</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/spring.html"><strong>15</strong><span>Grails and Spring</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/hibernate.html"><strong>16</strong><span>Grails and Hibernate</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/scaffolding.html"><strong>17</strong><span>Scaffolding</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/deployment.html"><strong>18</strong><span>Deployment</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0"><a href="../guide/contributing.html"><strong>19</strong><span>Contributing to Grails</span></a> |
| </div> |
| |
| </div> |
| </div> |
| </li> |
| <li class="separator selected"> |
| <a id="ref-button" onclick="localToggle(); return false;" href="#">Quick Reference</a> |
| </li> |
| </ul> |
| </div> |
| <div id="header"> |
| <div class="images clearfix"> |
| |
| <span id="logo"><a href="http://grails.org" target="_blank"><img alt="Grails Logo" title="The Grails Framework" src="../img/grails.png" border="0"/></a></span> |
| |
| |
| <span id="sponsor"><a href="http://springsource.com" target="_blank"><img alt="SpringSource Logo" title="SpringSource - Weapons for the War on Java Complexity" src="../img/springsource-logo.png" border="0"/></a></span> |
| |
| </div> |
| <p>See the light - agile, industrial strength, rapid web application development made easy</p> |
| </div> |
| |
| |
| <table id="colset" border="0" cellpadding="0" cellspacing="0"> |
| <tr> |
| <td id="col1"> |
| <div id="main" class="corner-all"> |
| |
| |
| <div class="toc-item prev-left"><a href="../guide/conf.html"><< <strong>4</strong><span>Configuration</span></a></div> |
| |
| |
| <span id='toggle-col1' class="toggle">(<a href="#" onclick="localToggle(); return false;">Quick Reference</a>)</span> |
| |
| |
| <div class="toc-item next-right"><a href="../guide/GORM.html"><strong>6</strong><span>Object Relational Mapping (GORM)</span> >></a></div> |
| |
| |
| |
| <div class="project"> |
| <h1>5 The Command Line - Reference Documentation</h1> |
| |
| <p><strong>Authors:</strong> Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith</p> |
| |
| <p><strong>Version:</strong> 2.1.5</p> |
| |
| |
| </div> |
| |
| |
| <div id="table-of-content"> |
| <h2>Table of Contents</h2> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#interactiveMode"><strong>5.1</strong><span>Interactive Mode</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#creatingGantScripts"><strong>5.2</strong><span>Creating Gant Scripts</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#reusingGrailsScripts"><strong>5.3</strong><span>Re-using Grails scripts</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#events"><strong>5.4</strong><span>Hooking into Events</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#buildCustomising"><strong>5.5</strong><span>Customising the build</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#antAndMaven"><strong>5.6</strong><span>Ant and Maven</span></a> |
| </div> |
| |
| <div class="toc-item" style="margin-left:0px"><a href="#wrapper"><strong>5.7</strong><span>Grails Wrapper</span></a> |
| </div> |
| |
| </div> |
| |
| |
| |
| <a name="4. The Command Line"><!-- Legacy link --></a> |
| <h1 id="commandLine">5 The Command Line</h1> |
| Grails' command line system is built on <a href="http://gant.codehaus.org/" target="blank">Gant</a> - a simple Groovy wrapper around <a href="http://ant.apache.org" target="blank">Apache Ant</a>.<p class="paragraph"/>However, Grails takes it further through the use of convention and the <code>grails</code> command. When you type:<p class="paragraph"/><div class="code"><pre>grails [command name]</pre></div><p class="paragraph"/>Grails searches in the following directories for Gant scripts to execute: |
| <ul class="star"> |
| <li><code>USER_HOME/.grails/scripts</code></li> |
| <li><code>PROJECT_HOME/scripts</code></li> |
| <li><code>PROJECT_HOME/plugins/*/scripts</code></li> |
| <li><code>GRAILS_HOME/scripts</code></li> |
| </ul><p class="paragraph"/>Grails will also convert command names that are in lower case form such as run-app into camel case. So typing<p class="paragraph"/><div class="code"><pre>grails run-app</pre></div><p class="paragraph"/>Results in a search for the following files: |
| <ul class="star"> |
| <li><code>USER_HOME/.grails/scripts/RunApp.groovy</code></li> |
| <li><code>PROJECT_HOME/scripts/RunApp.groovy</code></li> |
| <li><code>PLUGINS_HOME/*/scripts/RunApp.groovy</code></li> |
| <li><code>GLOBAL_PLUGINS_HOME/*/scripts/RunApp.groovy</code></li> |
| <li><code>GRAILS_HOME/scripts/RunApp.groovy</code></li> |
| </ul><p class="paragraph"/>If multiple matches are found Grails will give you a choice of which one to execute.<p class="paragraph"/>When Grails executes a Gant script, it invokes the "default" target defined in that script. If there is no default, Grails will quit with an error.<p class="paragraph"/>To get a list of all commands and some help about the available commands type:<p class="paragraph"/><div class="code"><pre>grails help</pre></div><p class="paragraph"/>which outputs usage instructions and the list of commands Grails is aware of:<p class="paragraph"/><div class="code"><pre>Usage (optionals marked with *): |
| grails [environment]* [target] [arguments]*<p class="paragraph"/>Examples: |
| grails dev run-app |
| grails create-app books<p class="paragraph"/>Available Targets (type grails help 'target-name' <span class="java-keyword">for</span> more info): |
| grails bootstrap |
| grails bug-report |
| grails clean |
| grails compile |
| ...</pre></div><p class="paragraph"/><blockquote class="note"> |
| Refer to the Command Line reference in the Quick Reference menu of the reference guide for more information about individual commands |
| </blockquote><p class="paragraph"/>It's often useful to provide custom arguments to the JVM when running Grails commands, in particular with <code>run-app</code> where you may for example want to set a higher maximum heap size. The Grails command will use any JVM options provided in the general <code>JAVA_OPTS</code> environment variable, but you can also specify a Grails-specific environment variable too:<p class="paragraph"/><div class="code"><pre>export GRAILS_OPTS=<span class="java-quote">"-Xmx1G -Xms256m -XX:MaxPermSize=256m"</span> |
| grails run-app</pre></div><p class="paragraph"/><h4>non-interactive mode</h4><p class="paragraph"/>When you run a script manually and it prompts you for information, you can answer the questions and continue running the script. But when you run a script as part of an automated process, for example a continuous integration build server, there's no way to "answer" the questions. So you can pass the <code>--non-interactive</code> switch to the script command to tell Grails to accept the default answer for any questions, for example whether to install a missing plugin.<p class="paragraph"/>For example:<p class="paragraph"/><div class="code"><pre>grails war --non-interactive</pre></div> |
| |
| |
| |
| <h2 id="interactiveMode">5.1 Interactive Mode</h2> |
| Interactive mode is the a feature of the Grails command line which keeps the JVM running and allows for quicker execution of commands. To activate interactive mode type 'grails' at the command line and then use TAB completion to get a list of commands:<p class="paragraph"/><img border="0" class="center" src="../img/interactive-output.png"></img><p class="paragraph"/>If you need to open a file whilst within interactive mode you can use the <code>open</code> command which will TAB complete file paths:<p class="paragraph"/><img border="0" class="center" src="../img/interactive-open-cmd.png"></img><p class="paragraph"/>Even better, the <code>open</code> command understands the logical aliases 'test-report' and 'dep-report', which will open the most recent test and dependency reports respectively. In other words, to open the test report in a browser simply execute <code>open test-report</code>. You can even open multiple files at once: <code>open test-report test/unit/MyTests.groovy</code> will open the HTML test report in your browser and the <code>MyTests.groovy</code> source file in your text editor.<p class="paragraph"/>TAB completion also works for class names after the <code>create-*</code> commands:<p class="paragraph"/><img border="0" class="center" src="../img/interactive-complete-class.png"></img><p class="paragraph"/>If you need to run an external process whilst interactive mode is running you can do so by starting the command with a !:<p class="paragraph"/><img border="0" class="center" src="../img/interactive-run-external.png"></img><p class="paragraph"/>Note that with ! (bang) commands, you get file path auto completion - ideal for external commands that operate on the file system such as 'ls', 'cat', 'git', etc. |
| |
| |
| <a name="4.1 Creating Gant Scripts"><!-- Legacy link --></a> |
| <h2 id="creatingGantScripts">5.2 Creating Gant Scripts</h2> |
| You can create your own Gant scripts by running the <a href="../ref/Command Line/create-script.html" class="commandLine">create-script</a> command from the root of your project. For example the following command:<p class="paragraph"/><div class="code"><pre>grails create-script compile-sources</pre></div><p class="paragraph"/>Will create a script called <code>scripts/CompileSources.groovy</code>. A Gant script itself is similar to a regular Groovy script except that it supports the concept of "targets" and dependencies between them:<p class="paragraph"/><div class="code"><pre>target(<span class="java-keyword">default</span>:<span class="java-quote">"The <span class="java-keyword">default</span> target is the one that gets executed by Grails"</span>) { |
| depends(clean, compile) |
| }<p class="paragraph"/>target(clean:<span class="java-quote">"Clean out things"</span>) { |
| ant.delete(dir:<span class="java-quote">"output"</span>) |
| }<p class="paragraph"/>target(compile:<span class="java-quote">"Compile some sources"</span>) { |
| ant.mkdir(dir:<span class="java-quote">"mkdir"</span>) |
| ant.javac(srcdir:<span class="java-quote">"src/java"</span>, destdir:<span class="java-quote">"output"</span>) |
| }</pre></div><p class="paragraph"/>As demonstrated in the script above, there is an implicit <code>ant</code> variable (an instance of <code>groovy.util.AntBuilder</code>) that allows access to the <a href="http://ant.apache.org/manual/index.html" target="blank">Apache Ant API</a>. |
| <blockquote class="note"> |
| In previous versions of Grails (1.0.3 and below), the variable was <code>Ant</code>, i.e. with a capital first letter. |
| </blockquote><p class="paragraph"/>You can also "depend" on other targets using the <code>depends</code> method demonstrated in the <code>default</code> target above.<p class="paragraph"/><h3>The default target</h3><p class="paragraph"/>In the example above, we specified a target with the explicit name "default". This is one way of defining the default target for a script. An alternative approach is to use the <code>setDefaultTarget()</code> method:<p class="paragraph"/><div class="code"><pre>target(<span class="java-quote">"clean-compile"</span>: <span class="java-quote">"Performs a clean compilation on the app source"</span>) { |
| depends(clean, compile) |
| }<p class="paragraph"/>target(clean:<span class="java-quote">"Clean out things"</span>) { |
| ant.delete(dir:<span class="java-quote">"output"</span>) |
| }<p class="paragraph"/>target(compile:<span class="java-quote">"Compile some sources"</span>) { |
| ant.mkdir(dir:<span class="java-quote">"mkdir"</span>) |
| ant.javac(srcdir:<span class="java-quote">"src/java"</span>, destdir:<span class="java-quote">"output"</span>) |
| }<p class="paragraph"/>setDefaultTarget(<span class="java-quote">"clean-compile"</span>)</pre></div><p class="paragraph"/>This lets you call the default target directly from other scripts if you wish. Also, although we have put the call to <code>setDefaultTarget()</code> at the end of the script in this example, it can go anywhere as long as it comes <em class="italic">after</em> the target it refers to ("clean-compile" in this case).<p class="paragraph"/>Which approach is better? To be honest, you can use whichever you prefer - there don't seem to be any major advantages in either case. One thing we would say is that if you want to allow other scripts to call your "default" target, you should move it into a shared script that doesn't have a default target at all. We'll talk some more about this in the next section. |
| |
| |
| <a name="4.2 Re-using Grails scripts"><!-- Legacy link --></a> |
| <h2 id="reusingGrailsScripts">5.3 Re-using Grails scripts</h2> |
| Grails ships with a lot of command line functionality out of the box that you may find useful in your own scripts (See the command line reference in the reference guide for info on all the commands). Of particular use are the <a href="../ref/Command Line/compile.html" class="commandLine">compile</a>, <a href="../ref/Command Line/package.html" class="commandLine">package</a> and <a href="../ref/Command Line/bootstrap.html" class="commandLine">bootstrap</a> scripts.<p class="paragraph"/>The <a href="../ref/Command Line/bootstrap.html" class="commandLine">bootstrap</a> script for example lets you bootstrap a Spring <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/context/ApplicationContext.html" class="api">ApplicationContext</a> instance to get access to the data source and so on (the integration tests use this):<p class="paragraph"/><div class="code"><pre>includeTargets << grailsScript(<span class="java-quote">"_GrailsBootstrap"</span>)<p class="paragraph"/>target ('<span class="java-keyword">default</span>': <span class="java-quote">"Database stuff"</span>) { |
| depends(configureProxy, packageApp, classpath, loadApp, configureApp)<p class="paragraph"/> Connection c |
| <span class="java-keyword">try</span> { |
| c = appCtx.getBean('dataSource').getConnection() |
| // <span class="java-keyword">do</span> something with connection |
| } |
| <span class="java-keyword">finally</span> { |
| c?.close() |
| } |
| }</pre></div><p class="paragraph"/><h3>Pulling in targets from other scripts</h3><p class="paragraph"/>Gant lets you pull in all targets (except "default") from another Gant script. You can then depend upon or invoke those targets as if they had been defined in the current script. The mechanism for doing this is the <code>includeTargets</code> property. Simply "append" a file or class to it using the left-shift operator: |
| <div class="code"><pre>includeTargets << <span class="java-keyword">new</span> File(<span class="java-quote">"/path/to/my/script.groovy"</span>) |
| includeTargets << gant.tools.Ivy</pre></div> |
| Don't worry too much about the syntax using a class, it's quite specialised. If you're interested, look into the Gant documentation.<p class="paragraph"/><h3>Core Grails targets</h3><p class="paragraph"/>As you saw in the example at the beginning of this section, you use neither the File- nor the class-based syntax for <code>includeTargets</code> when including core Grails targets. Instead, you should use the special <code>grailsScript()</code> method that is provided by the Grails command launcher (note that this is not available in normal Gant scripts, just Grails ones).<p class="paragraph"/>The syntax for the <code>grailsScript()</code> method is pretty straightforward: simply pass it the name of the Grails script to include, without any path information. Here is a list of Grails scripts that you could reuse: |
| <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th><strong class="bold">Script</strong></th><th><strong class="bold">Description</strong></th></tr><tr class="table-odd"><td>_GrailsSettings</td><td>You really should include this! Fortunately, it is included automatically by all other Grails scripts except _GrailsProxy, so you usually don't have to include it explicitly.</td></tr><tr class="table-even"><td>_GrailsEvents</td><td>Include this to fire events. Adds an <code>event(String eventName, List args)</code> method. Again, included by almost all other Grails scripts.</td></tr><tr class="table-odd"><td>_GrailsClasspath</td><td>Configures compilation, test, and runtime classpaths. If you want to use or play with them, include this script. Again, included by almost all other Grails scripts.</td></tr><tr class="table-even"><td>_GrailsProxy</td><td>If you don't have direct access to the internet and use a proxy, include this script to configure access through your proxy.</td></tr><tr class="table-odd"><td>_GrailsArgParsing</td><td>Provides a <code>parseArguments</code> target that does what it says on the tin: parses the arguments provided by the user when they run your script. Adds them to the <code>argsMap</code> property.</td></tr><tr class="table-even"><td>_GrailsTest</td><td>Contains all the shared test code. Useful if you want to add any extra tests.</td></tr><tr class="table-odd"><td>_GrailsRun</td><td>Provides all you need to run the application in the configured servlet container, either normally (<code>runApp</code>/<code>runAppHttps</code>) or from a WAR file (<code>runWar</code>/<code>runWarHttps</code>).</td></tr></table><p class="paragraph"/>There are many more scripts provided by Grails, so it is worth digging into the scripts themselves to find out what kind of targets are available. Anything that starts with an "_" is designed for reuse.<p class="paragraph"/><h3>Script architecture</h3><p class="paragraph"/>You maybe wondering what those underscores are doing in the names of the Grails scripts. That is Grails' way of determining that a script is <em class="italic">internal</em> , or in other words that it has not corresponding "command". So you can't run "grails _grails-settings" for example. That is also why they don't have a default target.<p class="paragraph"/>Internal scripts are all about code sharing and reuse. In fact, we recommend you take a similar approach in your own scripts: put all your targets into an internal script that can be easily shared, and provide simple command scripts that parse any command line arguments and delegate to the targets in the internal script. For example if you have a script that runs some functional tests, you can split it like this: |
| <div class="code"><pre>./scripts/FunctionalTests.groovy:<p class="paragraph"/>includeTargets << <span class="java-keyword">new</span> File(<span class="java-quote">"${basedir}/scripts/_FunctionalTests.groovy"</span>)<p class="paragraph"/>target(<span class="java-keyword">default</span>: <span class="java-quote">"Runs the functional tests <span class="java-keyword">for</span> <span class="java-keyword">this</span> project."</span>) { |
| depends(runFunctionalTests) |
| }<p class="paragraph"/>./scripts/_FunctionalTests.groovy:<p class="paragraph"/>includeTargets << grailsScript(<span class="java-quote">"_GrailsTest"</span>)<p class="paragraph"/>target(runFunctionalTests: <span class="java-quote">"Run functional tests."</span>) { |
| depends(...) |
| … |
| }</pre></div><p class="paragraph"/>Here are a few general guidelines on writing scripts: |
| <ul class="star"> |
| <li>Split scripts into a "command" script and an internal one.</li> |
| <li>Put the bulk of the implementation in the internal script.</li> |
| <li>Put argument parsing into the "command" script.</li> |
| <li>To pass arguments to a target, create some script variables and initialise them before calling the target.</li> |
| <li>Avoid name clashes by using closures assigned to script variables instead of targets. You can then pass arguments direct to the closures.</li> |
| </ul><p class="paragraph"/> |
| |
| <a name="4.3 Hooking into Events"><!-- Legacy link --></a> |
| <h2 id="events">5.4 Hooking into Events</h2> |
| Grails provides the ability to hook into scripting events. These are events triggered during execution of Grails target and plugin scripts.<p class="paragraph"/>The mechanism is deliberately simple and loosely specified. The list of possible events is not fixed in any way, so it is possible to hook into events triggered by plugin scripts, for which there is no equivalent event in the core target scripts.<p class="paragraph"/><h4>Defining event handlers</h4><p class="paragraph"/>Event handlers are defined in scripts called <code>_Events.groovy</code>. Grails searches for these scripts in the following locations: |
| <ul class="star"> |
| <li><code>USER_HOME/.grails/scripts</code> - user-specific event handlers</li> |
| <li><code>PROJECT_HOME/scripts</code> - applicaton-specific event handlers</li> |
| <li><code>PLUGINS_HOME/*/scripts</code> - plugin-specific event handlers</li> |
| <li><code>GLOBAL_PLUGINS_HOME/*/scripts</code> - event handlers provided by global plugins</li> |
| </ul><p class="paragraph"/>Whenever an event is fired, <em class="italic">all</em> the registered handlers for that event are executed. Note that the registration of handlers is performed automatically by Grails, so you just need to declare them in the relevant <code>_Events.groovy</code> file.<p class="paragraph"/>Event handlers are blocks defined in <code>_Events.groovy</code>, with a name beginning with "event". The following example can be put in your /scripts directory to demonstrate the feature:<p class="paragraph"/><div class="code"><pre>eventCreatedArtefact = { type, name -> |
| println <span class="java-quote">"Created $type $name"</span> |
| }<p class="paragraph"/>eventStatusUpdate = { msg -> |
| println msg |
| }<p class="paragraph"/>eventStatusFinal = { msg -> |
| println msg |
| }</pre></div><p class="paragraph"/>You can see here the three handlers <code>eventCreatedArtefact</code>, <code>eventStatusUpdate</code>, <code>eventStatusFinal</code>. Grails provides some standard events, which are documented in the command line reference guide. For example the <a href="../ref/Command Line/compile.html" class="commandLine">compile</a> command fires the following events: |
| <ul class="star"> |
| <li><code>CompileStart</code> - Called when compilation starts, passing the kind of compile - source or tests</li> |
| <li><code>CompileEnd</code> - Called when compilation is finished, passing the kind of compile - source or tests</li> |
| </ul><p class="paragraph"/><h4>Triggering events</h4><p class="paragraph"/>To trigger an event simply include the Init.groovy script and call the event() closure:<p class="paragraph"/><div class="code"><pre>includeTargets << grailsScript(<span class="java-quote">"_GrailsEvents"</span>)<p class="paragraph"/>event(<span class="java-quote">"StatusFinal"</span>, [<span class="java-quote">"Super duper plugin action complete!"</span>])</pre></div><p class="paragraph"/><h4>Common Events</h4><p class="paragraph"/>Below is a table of some of the common events that can be leveraged:<p class="paragraph"/><table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th>Event</th><th>Parameters</th><th>Description</th></tr><tr class="table-odd"><td>StatusUpdate</td><td>message</td><td>Passed a string indicating current script status/progress</td></tr><tr class="table-even"><td>StatusError</td><td>message</td><td>Passed a string indicating an error message from the current script</td></tr><tr class="table-odd"><td>StatusFinal</td><td>message</td><td>Passed a string indicating the final script status message, i.e. when completing a target, even if the target does not exit the scripting environment</td></tr><tr class="table-even"><td>CreatedArtefact</td><td>artefactType,artefactName</td><td>Called when a create-xxxx script has completed and created an artefact</td></tr><tr class="table-odd"><td>CreatedFile</td><td>fileName</td><td>Called whenever a project source filed is created, not including files constantly managed by Grails</td></tr><tr class="table-even"><td>Exiting</td><td>returnCode</td><td>Called when the scripting environment is about to exit cleanly</td></tr><tr class="table-odd"><td>PluginInstalled</td><td>pluginName</td><td>Called after a plugin has been installed</td></tr><tr class="table-even"><td>CompileStart</td><td>kind</td><td>Called when compilation starts, passing the kind of compile - source or tests</td></tr><tr class="table-odd"><td>CompileEnd</td><td>kind</td><td>Called when compilation is finished, passing the kind of compile - source or tests</td></tr><tr class="table-even"><td>DocStart</td><td>kind</td><td>Called when documentation generation is about to start - javadoc or groovydoc</td></tr><tr class="table-odd"><td>DocEnd</td><td>kind</td><td>Called when documentation generation has ended - javadoc or groovydoc</td></tr><tr class="table-even"><td>SetClasspath</td><td>rootLoader</td><td>Called during classpath initialization so plugins can augment the classpath with rootLoader.addURL(...). Note that this augments the classpath <strong class="bold">after</strong> event scripts are loaded so you cannot use this to load a class that your event script needs to import, although you can do this if you load the class by name.</td></tr><tr class="table-odd"><td>PackagingEnd</td><td>none</td><td>Called at the end of packaging (which is called prior to the Tomcat server being started and after web.xml is generated)</td></tr></table> |
| |
| |
| <a name="4.4 Customising the build"><!-- Legacy link --></a> |
| <h2 id="buildCustomising">5.5 Customising the build</h2> |
| Grails is most definitely an opinionated framework and it prefers convention to configuration, but this doesn't mean you <em class="italic">can't</em> configure it. In this section, we look at how you can influence and modify the standard Grails build.<p class="paragraph"/><h3>The defaults</h3><p class="paragraph"/>The core of the Grails build configuration is the <code>grails.util.BuildSettings</code> class, which contains quite a bit of useful information. It controls where classes are compiled to, what dependencies the application has, and other such settings.<p class="paragraph"/>Here is a selection of the configuration options and their default values: |
| <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th><strong class="bold">Property</strong></th><th><strong class="bold">Config option</strong></th><th><strong class="bold">Default value</strong></th></tr><tr class="table-odd"><td>grailsWorkDir</td><td>grails.work.dir</td><td>$USER_HOME/.grails/<grailsVersion></td></tr><tr class="table-even"><td>projectWorkDir</td><td>grails.project.work.dir</td><td><grailsWorkDir>/projects/<baseDirName></td></tr><tr class="table-odd"><td>classesDir</td><td>grails.project.class.dir</td><td><projectWorkDir>/classes</td></tr><tr class="table-even"><td>testClassesDir</td><td>grails.project.test.class.dir</td><td><projectWorkDir>/test-classes</td></tr><tr class="table-odd"><td>testReportsDir</td><td>grails.project.test.reports.dir</td><td><projectWorkDir>/test/reports</td></tr><tr class="table-even"><td>resourcesDir</td><td>grails.project.resource.dir</td><td><projectWorkDir>/resources</td></tr><tr class="table-odd"><td>projectPluginsDir</td><td>grails.project.plugins.dir</td><td><projectWorkDir>/plugins</td></tr><tr class="table-even"><td>globalPluginsDir</td><td>grails.global.plugins.dir</td><td><grailsWorkDir>/global-plugins</td></tr><tr class="table-odd"><td>verboseCompile</td><td>grails.project.compile.verbose</td><td><code>false</code></td></tr></table><p class="paragraph"/>The <code>BuildSettings</code> class has some other properties too, but they should be treated as read-only: |
| <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th><strong class="bold">Property</strong></th><th><strong class="bold">Description</strong></th></tr><tr class="table-odd"><td>baseDir</td><td>The location of the project.</td></tr><tr class="table-even"><td>userHome</td><td>The user's home directory.</td></tr><tr class="table-odd"><td>grailsHome</td><td>The location of the Grails installation in use (may be <code>null</code>).</td></tr><tr class="table-even"><td>grailsVersion</td><td>The version of Grails being used by the project.</td></tr><tr class="table-odd"><td>grailsEnv</td><td>The current Grails environment.</td></tr><tr class="table-even"><td>config</td><td>The configuration settings defined in the project's <code>BuildConfig.groovy</code> file. Access properties in the same way as you access runtime settings: <code>grailsSettings.config.foo.bar.hello</code>.</td></tr><tr class="table-odd"><td>compileDependencies</td><td>A list of compile-time project dependencies as <code>File</code> instances.</td></tr><tr class="table-even"><td>testDependencies</td><td>A list of test-time project dependencies as <code>File</code> instances.</td></tr><tr class="table-odd"><td>runtimeDependencies</td><td>A list of runtime-time project dependencies as <code>File</code> instances.</td></tr></table><p class="paragraph"/>Of course, these properties aren't much good if you can't get hold of them. Fortunately that's easy to do: an instance of <code>BuildSettings</code> is available to your scripts as the <code>grailsSettings</code> script variable. You can also access it from your code by using the <code>grails.util.BuildSettingsHolder</code> class, but this isn't recommended.<p class="paragraph"/><h3>Overriding the defaults</h3><p class="paragraph"/>All of the properties in the first table can be overridden by a system property or a configuration option - simply use the "config option" name. For example, to change the project working directory, you could either run this command: |
| <div class="code"><pre>grails -Dgrails.project.work.dir=work compile</pre></div> |
| or add this option to your <code>grails-app/conf/BuildConfig.groovy</code> file: |
| <div class="code"><pre>grails.project.work.dir = <span class="java-quote">"work"</span></pre></div> |
| Note that the default values take account of the property values they depend on, so setting the project working directory like this would also relocate the compiled classes, test classes, resources, and plugins.<p class="paragraph"/>What happens if you use both a system property and a configuration option? Then the system property wins because it takes precedence over the <code>BuildConfig.groovy</code> file, which in turn takes precedence over the default values.<p class="paragraph"/>The <code>BuildConfig.groovy</code> file is a sibling of <code>grails-app/conf/Config.groovy</code> - the former contains options that only affect the build, whereas the latter contains those that affect the application at runtime. It's not limited to the options in the first table either: you will find build configuration options dotted around the documentation, such as ones for specifying the port that the embedded servlet container runs on or for determining what files get packaged in the WAR file.<p class="paragraph"/><h3>Available build settings</h3><p class="paragraph"/><table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th>Name</th><th>Description</th></tr><tr class="table-odd"><td>grails.server.port.http</td><td>Port to run the embedded servlet container on ("run-app" and "run-war"). Integer.</td></tr><tr class="table-even"><td>grails.server.port.https</td><td>Port to run the embedded servlet container on for HTTPS ("run-app --https" and "run-war --https"). Integer.</td></tr><tr class="table-odd"><td>grails.config.base.webXml</td><td>Path to a custom web.xml file to use for the application (alternative to using the web.xml template).</td></tr><tr class="table-even"><td>grails.compiler.dependencies</td><td>Legacy approach to adding extra dependencies to the compiler classpath. Set it to a closure containing "fileset()" entries. These entries will be processed by an <code>AntBuilder</code> so the syntax is the Groovy form of the corresponding XML elements in an Ant build file, e.g. <code>fileset(dir: "$basedir/lib", include: "**/*.class)</code>.</td></tr><tr class="table-odd"><td>grails.testing.patterns</td><td>A list of Ant path patterns that let you control which files are included in the tests. The patterns should not include the test case suffix, which is set by the next property.</td></tr><tr class="table-even"><td>grails.testing.nameSuffix</td><td>By default, tests are assumed to have a suffix of "Tests". You can change it to anything you like but setting this option. For example, another common suffix is "Test".</td></tr><tr class="table-odd"><td>grails.project.war.file</td><td>A string containing the file path of the generated WAR file, along with its full name (include extension). For example, "target/my-app.war".</td></tr><tr class="table-even"><td>grails.war.dependencies</td><td>A closure containing "fileset()" entries that allows you complete control over what goes in the WAR's "WEB-INF/lib" directory.</td></tr><tr class="table-odd"><td>grails.war.copyToWebApp</td><td>A closure containing "fileset()" entries that allows you complete control over what goes in the root of the WAR. It overrides the default behaviour of including everything under "web-app".</td></tr><tr class="table-even"><td>grails.war.resources</td><td>A closure that takes the location of the staging directory as its first argument. You can use any Ant tasks to do anything you like. It is typically used to remove files from the staging directory before that directory is jar'd up into a WAR.</td></tr><tr class="table-odd"><td>grails.project.web.xml</td><td>The location to generate Grails' web.xml to</td></tr></table><p class="paragraph"/><h3>Reloading Agent Cache Directory</h3><p class="paragraph"/>Grails uses an agent based reloading system in the development environment that allows source code changes to be picked up while the application is running. This reloading agent caches information needed to carry out the reloading efficiently. By default this information is stored under <code><USER_HOME_DIR>/.grails/.slcache/</code>. The <code>GRAILS_AGENT_CACHE_DIR</code> environment variable may be assigned a value to cause this cache information to be stored somewhere else. Note that this is an operating system environment variable, not a JVM system property or a property which may be defined in <code>BuildConfig.groovy</code>. This setting must be defined as an environment variable because the agent cache directory must be configured very early in the JVM startup process, before any Grails code is executed. |
| |
| |
| <a name="4.5 Ant and Maven"><!-- Legacy link --></a> |
| <h2 id="antAndMaven">5.6 Ant and Maven</h2> |
| If all the other projects in your team or company are built using a standard build tool such as Ant or Maven, you become the black sheep of the family when you use the Grails command line to build your application. Fortunately, you can easily integrate the Grails build system into the main build tools in use today (well, the ones in use in Java projects at least).<p class="paragraph"/><h3>Ant Integration</h3><p class="paragraph"/>When you create a Grails application with the <a href="../ref/Command Line/create-app.html" class="commandLine">create-app</a> command, Grails doesn't automatically create an Ant <code>build.xml</code> file but you can generate one with the <a href="../ref/Command Line/integrate-with.html" class="commandLine">integrate-with</a> command:<p class="paragraph"/><pre class="bq"><code> |
| grails integrate-with --ant</code></pre><p class="paragraph"/>This creates a <code>build.xml</code> file containing the following targets: |
| <ul class="star"> |
| <li><code>clean</code> - Cleans the Grails application</li> |
| <li><code>compile</code> - Compiles your application's source code</li> |
| <li><code>test</code> - Runs the unit tests</li> |
| <li><code>run</code> - Equivalent to "grails run-app"</li> |
| <li><code>war</code> - Creates a WAR file</li> |
| <li><code>deploy</code> - Empty by default, but can be used to implement automatic deployment</li> |
| </ul><p class="paragraph"/>Each of these can be run by Ant, for example:<p class="paragraph"/><div class="code"><pre>ant war</pre></div><p class="paragraph"/>The build file is configured to use <a href="http://ant.apache.org/ivy/" target="blank">Apache Ivy</a> for dependency management, which means that it will automatically download all the requisite Grails JAR files and other dependencies on demand. You don't even have to install Grails locally to use it! That makes it particularly useful for continuous integration systems such as <a href="http://cruisecontrol.sourceforge.net/" target="blank">CruiseControl</a> or <a href="http://jenkins-ci.org/" target="blank">Jenkins</a>.<p class="paragraph"/>It uses the Grails <a href="../api/grails/ant/GrailsTask.html" class="api">Ant task</a> to hook into the existing Grails build system. The task lets you run any Grails script that's available, not just the ones used by the generated build file. To use the task, you must first declare it: |
| <div class="code"><pre><taskdef name=<span class="java-quote">"grailsTask"</span> |
| classname=<span class="java-quote">"grails.ant.GrailsTask"</span> |
| classpathref=<span class="java-quote">"grails.classpath"</span>/></pre></div><p class="paragraph"/>This raises the question: what should be in "grails.classpath"? The task itself is in the "grails-bootstrap" JAR artifact, so that needs to be on the classpath at least. You should also include the "groovy-all" JAR. With the task defined, you just need to use it! The following table shows you what attributes are available: |
| <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"><tr><th>Attribute</th><th>Description</th><th>Required</th></tr><tr class="table-odd"><td>home</td><td>The location of the Grails installation directory to use for the build.</td><td>Yes, unless classpath is specified.</td></tr><tr class="table-even"><td>classpathref</td><td>Classpath to load Grails from. Must include the "grails-bootstrap" artifact and should include "grails-scripts".</td><td>Yes, unless <code>home</code> is set or you use a <code>classpath</code> element.</td></tr><tr class="table-odd"><td>script</td><td>The name of the Grails script to run, e.g. "TestApp".</td><td>Yes.</td></tr><tr class="table-even"><td>args</td><td>The arguments to pass to the script, e.g. "-unit -xml".</td><td>No. Defaults to "".</td></tr><tr class="table-odd"><td>environment</td><td>The Grails environment to run the script in.</td><td>No. Defaults to the script default.</td></tr><tr class="table-even"><td>includeRuntimeClasspath</td><td>Advanced setting: adds the application's runtime classpath to the build classpath if true.</td><td>No. Defaults to <code>true</code>.</td></tr></table><p class="paragraph"/>The task also supports the following nested elements, all of which are standard Ant path structures: |
| <ul class="star"> |
| <li><code>classpath</code> - The build classpath (used to load Gant and the Grails scripts).</li> |
| <li><code>compileClasspath</code> - Classpath used to compile the application's classes.</li> |
| <li><code>runtimeClasspath</code> - Classpath used to run the application and package the WAR. Typically includes everything in @compileClasspath.</li> |
| <li><code>testClasspath</code> - Classpath used to compile and run the tests. Typically includes everything in <code>runtimeClasspath</code>.</li> |
| </ul><p class="paragraph"/>How you populate these paths is up to you. If you use the <code>home</code> attribute and put your own dependencies in the <code>lib</code> directory, then you don't even need to use any of them. For an example of their use, take a look at the generated Ant build file for new apps.<p class="paragraph"/><h3>Maven Integration</h3><p class="paragraph"/>Grails provides integration with <a href="http://maven.apache.org" target="blank">Maven 2</a> with a Maven plugin.<p class="paragraph"/><h4>Preparation</h4><p class="paragraph"/>In order to use the Maven plugin, all you need is Maven 2 installed and set up. This is because <strong class="bold">you no longer need to install Grails separately to use it with Maven!</strong><p class="paragraph"/><blockquote class="note"> |
| The Maven 2 integration for Grails has been designed and tested for Maven 2.0.9 and above. It will not work with earlier versions. |
| </blockquote><p class="paragraph"/><blockquote class="note"> |
| The default mvn setup DOES NOT supply sufficient memory to run the Grails environment. We recommend that you add the following environment variable setting to prevent poor performance:<p class="paragraph"/><code>export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256"</code> |
| </blockquote><p class="paragraph"/><h4>Creating a Grails Maven Project</h4><p class="paragraph"/>Using the <code>create-pom</code> command you can generate a valid Maven <code>pom.xml</code> file for any existing Grails project. The below presents an example:<p class="paragraph"/><div class="code"><pre>$ grails create-app myapp |
| $ cd myapp |
| $ grails create-pom com.mycompany</pre></div><p class="paragraph"/>The <code>create-pom</code> command expects a group id as an argument. The name and the version are taken from the <code>application.properties</code> of the application. The Maven plugin will keep the version in the <code>pom.xml</code> in sync with the version in <code>application.properties</code>.<p class="paragraph"/>The following standard Maven commands are then possible: |
| <ul class="star"> |
| <li><code>compile</code> - Compiles a Grails project</li> |
| <li><code>package</code> - Builds a WAR file from the Grails project.</li> |
| <li><code>install</code> - Builds a WAR file (or plugin zip/jar if a plugin) and installs it into your local Maven cache</li> |
| <li><code>test</code> - Runs the tests of a Grails project</li> |
| <li><code>clean</code> - Cleans the Grails project</li> |
| </ul><p class="paragraph"/>Other standard Maven commands will likely work too.<p class="paragraph"/>You can also use some of the Grails commands that have been wrapped as Maven goals: |
| <ul class="star"> |
| <li><code>grails:create-controller</code> - Calls the <a href="../ref/Command Line/create-controller.html" class="commandLine">create-controller</a> command</li> |
| <li><code>grails:create-domain-class</code> - Calls the <a href="../ref/Command Line/create-domain-class.html" class="commandLine">create-domain-class</a> command</li> |
| <li><code>grails:create-integration-test</code> - Calls the <a href="../ref/Command Line/create-integration-test.html" class="commandLine">create-integration-test</a> command</li> |
| <li><code>grails:create-pom</code> - Creates a new Maven POM for an existing Grails project</li> |
| <li><code>grails:create-script</code> - Calls the <a href="../ref/Command Line/create-script.html" class="commandLine">create-script</a> command</li> |
| <li><code>grails:create-service</code> - Calls the <a href="../ref/Command Line/create-service.html" class="commandLine">create-service</a> command</li> |
| <li><code>grails:create-taglib</code> - Calls the <a href="../ref/Command Line/create-tag-lib.html" class="commandLine">create-tag-lib</a> command</li> |
| <li><code>grails:create-unit-test</code> - Calls the <a href="../ref/Command Line/create-unit-test.html" class="commandLine">create-unit-test</a> command</li> |
| <li><code>grails:exec</code> - Executes an arbitrary Grails command line script</li> |
| <li><code>grails:generate-all</code> - Calls the <a href="../ref/Command Line/generate-all.html" class="commandLine">generate-all</a> command</li> |
| <li><code>grails:generate-controller</code> - Calls the <a href="../ref/Command Line/generate-controller.html" class="commandLine">generate-controller</a> command</li> |
| <li><code>grails:generate-views</code> - Calls the <a href="../ref/Command Line/generate-views.html" class="commandLine">generate-views</a> command</li> |
| <li><code>grails:install-templates</code> - Calls the <a href="../ref/Command Line/install-templates.html" class="commandLine">install-templates</a> command</li> |
| <li><code>grails:list-plugins</code> - Calls the <a href="../ref/Command Line/list-plugins.html" class="commandLine">list-plugins</a> command</li> |
| <li><code>grails:package</code> - Calls the <a href="../ref/Command Line/package.html" class="commandLine">package</a> command</li> |
| <li><code>grails:run-app</code> - Calls the <a href="../ref/Command Line/run-app.html" class="commandLine">run-app</a> command</li> |
| </ul><p class="paragraph"/>For a complete, up to date list, run <code>mvn grails:help</code><p class="paragraph"/><h4>Creating a Grails Maven Project using the Archetype</h4><p class="paragraph"/>You can create a Maven Grails project without having Grails installed, simply run the following command:<p class="paragraph"/><div class="code"><pre>mvn archetype:generate -DarchetypeGroupId=org.grails \ |
| -DarchetypeArtifactId=grails-maven-archetype \ |
| -DarchetypeVersion=2.1.0.RC1 \ |
| -DgroupId=example -DartifactId=my-app</pre></div><p class="paragraph"/>Choose whichever grails version, group ID and artifact ID you want for your application, but everything else must be as written. This will create a new Maven project with a POM and a couple of other files. What you won't see is anything that looks like a Grails application. So, the next step is to create the project structure that you're used to. |
| But first, to set target JDK to Java 6, do that now. Open my-app/pom.xml and change<p class="paragraph"/><div class="code"><pre><plugin> |
| <artifactId>maven-compiler-plugin</artifactId> |
| <configuration> |
| <source>1.5</source> |
| <target>1.5</target> |
| </configuration> |
| </plugin></pre></div> |
| to |
| <div class="code"><pre><plugin> |
| <artifactId>maven-compiler-plugin</artifactId> |
| <configuration> |
| <source>1.6</source> |
| <target>1.6</target> |
| </configuration> |
| </plugin></pre></div><p class="paragraph"/>Then you're ready to create the project structure:<p class="paragraph"/><div class="code"><pre>cd my-app |
| mvn initialize</pre></div><p class="paragraph"/><h4>Defining Plugin Dependencies</h4><p class="paragraph"/>All Grails plugins are published to a standard Maven repository located at <a href="http://repo.grails.org/grails/plugins/" target="blank"></a>. When using the Maven plugin for Grails you must ensure that this repository is declared in your list of remote repositories:<p class="paragraph"/><div class="code"><pre><span class="xml-tag"><repository></span> |
| <span class="xml-tag"><id></span>grails-plugins<span class="xml-tag"></id></span> |
| <span class="xml-tag"><name></span>grails-plugins<span class="xml-tag"></name></span> |
| <span class="xml-tag"><url></span>http://repo.grails.org/grails/plugins<span class="xml-tag"></url></span> |
| <span class="xml-tag"></repository></span></pre></div><p class="paragraph"/>With this done you can declare plugin dependencies within your <code>pom.xml</code> file:<p class="paragraph"/><div class="code"><pre><span class="xml-tag"><dependency></span> |
| <span class="xml-tag"><groupId></span>org.grails.plugins<span class="xml-tag"></groupId></span> |
| <span class="xml-tag"><artifactId></span>database-migration<span class="xml-tag"></artifactId></span> |
| <span class="xml-tag"><version></span>1.1<span class="xml-tag"></version></span> |
| <span class="xml-tag"><scope></span>runtime<span class="xml-tag"></scope></span> |
| <span class="xml-tag"><type></span>zip<span class="xml-tag"></type></span> |
| <span class="xml-tag"></dependency></span></pre></div><p class="paragraph"/>Note that the <code>type</code> element must be set to <code>zip</code>.<p class="paragraph"/><h4>Forked Grails Execution</h4><p class="paragraph"/>By default the Maven plugin will run Grails commands in-process, meaning that the Grails process occupies the same JVM as the Maven process. This can put strain on the Maven process for particularly large applications.<p class="paragraph"/>In this case it is recommended to use forked execution. Forked execution can be configured in the <code>configuration</code> element of the plugin:<p class="paragraph"/><div class="code"><pre><plugin> |
| <groupId>org.grails</groupId> |
| <artifactId>grails-maven-plugin</artifactId> |
| <version>${grails.version}</version> |
| <configuration> |
| <!-- Whether <span class="java-keyword">for</span> Fork a JVM to run Grails commands --> |
| <fork><span class="java-keyword">true</span></fork> |
| </configuration> |
| <extensions><span class="java-keyword">true</span></extensions> |
| </plugin></pre></div><p class="paragraph"/>With this configuration in place a separate JVM will be forked when running Grails commands. If you wish to debug the JVM that is forked you can add the <code>forkDebug</code> element:<p class="paragraph"/><div class="code"><pre><span class="xml-comment"><!-- Whether for Fork a JVM to run Grails commands --></span> |
| <span class="xml-tag"><fork></span>true<span class="xml-tag"></fork></span> |
| <span class="xml-tag"><forkDebug></span>true<span class="xml-tag"></forkDebug></span></pre></div><p class="paragraph"/>If you need to customize the memory of the forked process the following elements are available: |
| <ul class="star"> |
| <li><code>forkMaxMemory</code> - The maximum amount of heap (default 1024)</li> |
| <li><code>forkMinMemory</code> - The minimum amount of heap (default 512)</li> |
| <li><code>forkPermGen</code> - The amount of permgen (default 256)</li> |
| </ul><p class="paragraph"/><h4>Multi Module Maven Builds</h4><p class="paragraph"/>The Maven plugin can be used to power multi-module Grails builds. The easiest way to set this is up is with the <code>create-multi-project-build</code> command:<p class="paragraph"/><div class="code"><pre>$ grails create-app myapp |
| $ grails create-plugin plugin1 |
| $ grails create-plugin plugin2 |
| $ grails create-multi-project-build org.mycompany:parent:1.0</pre></div><p class="paragraph"/>Running <code>mvn install</code> will build all projects together. To enable the 'grails' command to read the POMs you can modify <code>BuildConfig.groovy</code> to use the POM and resolve dependencies from your Maven local cache:<p class="paragraph"/><div class="code"><pre>grails.project.dependency.resolution = { |
| … |
| pom <span class="java-keyword">true</span> |
| repositories { |
| … |
| mavenLocal() |
| } |
| }</pre></div><p class="paragraph"/>By reading the <code>pom.xml</code> file you can do an initial <code>mvn install</code> from the parent project to build all plugins and install them into your local maven cache and then <code>cd</code> into your project and use the regular <code>grails run-app</code> command to run your application. All previously built plugins will be resolved from the local Maven cache.<p class="paragraph"/><h4>Adding Grails commands to phases</h4><p class="paragraph"/>The standard POM created for you by Grails already attaches the appropriate core Grails commands to their corresponding build phases, so "compile" goes in the "compile" phase and "war" goes in the "package" phase. That doesn't help though when you want to attach a plugin's command to a particular phase. The classic example is functional tests. How do you make sure that your functional tests (using which ever plugin you have decided on) are run during the "integration-test" phase?<p class="paragraph"/>Fear not: all things are possible. In this case, you can associate the command to a phase using an extra "execution" block:<p class="paragraph"/><div class="code"><pre><span class="xml-tag"><plugin></span> |
| <span class="xml-tag"><groupId></span>org.grails<span class="xml-tag"></groupId></span> |
| <span class="xml-tag"><artifactId></span>grails-maven-plugin<span class="xml-tag"></artifactId></span> |
| <span class="xml-tag"><version></span>2.1.0.RC2<span class="xml-tag"></version></span> |
| <span class="xml-tag"><extensions></span>true<span class="xml-tag"></extensions></span> |
| <span class="xml-tag"><executions></span> |
| <span class="xml-tag"><execution></span> |
| <span class="xml-tag"><goals></span> |
| … |
| <span class="xml-tag"></goals></span> |
| <span class="xml-tag"></execution></span> |
| <span class="xml-comment"><!-- Add the <span class="xml-quote">"functional-tests"</span> command to the <span class="xml-quote">"integration-test"</span> phase --></span> |
| <span class="xml-tag"><execution></span> |
| <span class="xml-tag"><id></span>functional-tests<span class="xml-tag"></id></span> |
| <span class="xml-tag"><phase></span>integration-test<span class="xml-tag"></phase></span> |
| <span class="xml-tag"><goals></span> |
| <span class="xml-tag"><goal></span>exec<span class="xml-tag"></goal></span> |
| <span class="xml-tag"></goals></span> |
| <span class="xml-tag"><configuration></span> |
| <span class="xml-tag"><command></span>functional-tests<span class="xml-tag"></command></span> |
| <span class="xml-tag"></configuration></span> |
| <span class="xml-tag"></execution></span> |
| <span class="xml-tag"></executions></span> |
| <span class="xml-tag"></plugin></span></pre></div><p class="paragraph"/>This also demonstrates the <code>grails:exec</code> goal, which can be used to run any Grails command. Simply pass the name of the command as the <code>command</code> system property, and optionally specify the arguments with the <code>args</code> property:<p class="paragraph"/><div class="code"><pre>mvn grails:exec -Dcommand=create-webtest -Dargs=Book</pre></div><p class="paragraph"/><h4>Debugging a Grails Maven Project</h4><p class="paragraph"/>Maven can be launched in debug mode using the "mvnDebug" command. To launch your Grails application in debug, simply run:<p class="paragraph"/><div class="code"><pre>mvnDebug grails:run-app</pre></div><p class="paragraph"/>The process will be suspended on startup and listening for a debugger on port 8000.<p class="paragraph"/>If you need more control of the debugger, this can be specified using the MAVEN_OPTS environment variable, and launch Maven with the default "mvn" command:<p class="paragraph"/><div class="code"><pre>MAVEN_OPTS=<span class="java-quote">"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"</span> |
| mvn grails:run-app</pre></div><p class="paragraph"/><h4>Raising issues</h4><p class="paragraph"/>If you come across any problems with the Maven integration, please raise a <a href="http://jira.grails.org/browse/MAVEN" target="blank">JIRA issue</a>. |
| |
| |
| |
| <h2 id="wrapper">5.7 Grails Wrapper</h2> |
| The Grails Wrapper allows a Grails application to built without having to install Grails and configure a GRAILS_HOME environment variable. The wrapper includes a small shell script and a couple of small bootstrap jar files that typically would be checked in to source code control along with the rest of the project. The first time the wrapper is executed it will download and configure a Grails installation. This wrapper makes it more simple to setup a development environment, configure CI and manage upgrades to future versions of Grails. When the application is upgraded to the next version of Grails, the wrapper is updated and checked in to the source code control system and the next time developers update their workspace and run the wrapper, they will automatically be using the correct version of Grails.<p class="paragraph"/><h4>Generating The Wrapper</h4><p class="paragraph"/>The <a href="../ref/Command Line/wrapper.html" class="commandLine">wrapper</a> command can be used to generate the wrapper shell scripts and supporting jar files. Execute the wrapper command at the top of an existing Grails project.<p class="paragraph"/><div class="code"><pre>grails wrapper</pre></div><p class="paragraph"/>In order to do this of course Grails must be installed and configured. This is only a requirement for bootstrapping the wrapper. Once the wrapper is generated there is no need to have a Grails installation configured in order to use the wrapper.<p class="paragraph"/>See the <a href="../ref/Command Line/wrapper.html" class="commandLine">wrapper</a> command documentation for details about command line arguments.<p class="paragraph"/>By default the wrapper command will generate a <code>grailsw</code> shell script and <code>grailsw.bat</code> batch file at the top of the project. In addition to those, a <code>wrapper/</code> directory (the name of the directory is configurable via command line options) is generated which contains some support files which are necessary to run the wrapper. All of these files should be checked into the source code control system along with the rest of the project. This allows developers to check the project out of source code control and immediately start using the wrapper to execute Grails commands without having to install and configure Grails.<p class="paragraph"/><h4>Using The Wrapper</h4><p class="paragraph"/>The wrapper script accepts all of the same arguments as the normal grails command.<p class="paragraph"/><div class="code"><pre>./grailsw create-domain-class com.demo.Person |
| ./grailsw run-app |
| ./grailsw test-app unit:<p class="paragraph"/>etc...</pre></div> |
| |
| |
| |
| <div style="clear:both;margin-top:15px;"></div> |
| |
| <div class="toc-item prev-left"><a href="../guide/conf.html"><< <strong>4</strong><span>Configuration</span></a></div> |
| |
| <div class="toc-item next-right"><a href="../guide/GORM.html"><strong>6</strong><span>Object Relational Mapping (GORM)</span> >></a></div> |
| |
| <div style="clear:both"></div> |
| </div> |
| </td> |
| <td id="col2"> |
| <div class="local clearfix"> |
| <div class="local-title"> |
| <a href="../guide/index.html" target="mainFrame">Quick Reference</a> |
| <span class="toggle">(<a href="#" onclick="localToggle(); return false;">hide</a>)</span> |
| </div> |
| <div class="menu"> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Command Line</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/add-proxy.html">add-proxy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/alias.html">alias</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/bootstrap.html">bootstrap</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/bug-report.html">bug-report</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/clean.html">clean</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/clear-proxy.html">clear-proxy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/compile.html">compile</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/console.html">console</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-app.html">create-app</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-controller.html">create-controller</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-domain-class.html">create-domain-class</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-filters.html">create-filters</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-hibernate-cfg-xml.html">create-hibernate-cfg-xml</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-integration-test.html">create-integration-test</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-multi-project-build.html">create-multi-project-build</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-plugin.html">create-plugin</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-pom.html">create-pom</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-scaffold-controller.html">create-scaffold-controller</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-script.html">create-script</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-service.html">create-service</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-tag-lib.html">create-tag-lib</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/create-unit-test.html">create-unit-test</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/dependency-report.html">dependency-report</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/doc.html">doc</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/generate-all.html">generate-all</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/generate-controller.html">generate-controller</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/generate-views.html">generate-views</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/help.html">help</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/init.html">init</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/install-dependency.html">install-dependency</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/install-plugin.html">install-plugin</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/install-templates.html">install-templates</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/integrate-with.html">integrate-with</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/interactive.html">interactive</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/list-plugin-updates.html">list-plugin-updates</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/list-plugins.html">list-plugins</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/migrate-docs.html">migrate-docs</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/package-plugin.html">package-plugin</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/package.html">package</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/plugin-info.html">plugin-info</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/refresh-dependencies.html">refresh-dependencies</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/remove-proxy.html">remove-proxy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/run-app.html">run-app</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/run-script.html">run-script</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/run-war.html">run-war</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/schema-export.html">schema-export</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/set-proxy.html">set-proxy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/set-version.html">set-version</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/shell.html">shell</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/stats.html">stats</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/test-app.html">test-app</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/uninstall-plugin.html">uninstall-plugin</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/upgrade.html">upgrade</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/war.html">war</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Command%20Line/wrapper.html">wrapper</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Constraints</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Constraints/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Constraints/attributes.html">attributes</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/bindable.html">bindable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/blank.html">blank</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/creditCard.html">creditCard</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/email.html">email</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/inList.html">inList</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/matches.html">matches</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/max.html">max</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/maxSize.html">maxSize</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/min.html">min</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/minSize.html">minSize</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/notEqual.html">notEqual</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/nullable.html">nullable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/range.html">range</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/scale.html">scale</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/size.html">size</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/unique.html">unique</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/url.html">url</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/validator.html">validator</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Constraints/widget.html">widget</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Controllers</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Controllers/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Controllers/actionName.html">actionName</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/afterInterceptor.html">afterInterceptor</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/allowedMethods.html">allowedMethods</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/beforeInterceptor.html">beforeInterceptor</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/bindData.html">bindData</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/chain.html">chain</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/controllerName.html">controllerName</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/defaultAction.html">defaultAction</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/flash.html">flash</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/forward.html">forward</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/grailsApplication.html">grailsApplication</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/params.html">params</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/redirect.html">redirect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/render.html">render</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/request.html">request</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/response.html">response</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/servletContext.html">servletContext</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/session.html">session</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/withForm.html">withForm</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Controllers/withFormat.html">withFormat</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Database Mapping</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/autoImport.html">autoImport</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/autoTimestamp.html">autoTimestamp</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/batchSize.html">batchSize</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/cache.html">cache</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/cascade.html">cascade</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/column.html">column</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/discriminator.html">discriminator</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/dynamicInsert.html">dynamicInsert</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/dynamicUpdate.html">dynamicUpdate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/fetch.html">fetch</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/id.html">id</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/ignoreNotFound.html">ignoreNotFound</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/indexColumn.html">indexColumn</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/insertable.html">insertable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/joinTable.html">joinTable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/lazy.html">lazy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/order.html">order</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/sort.html">sort</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/table.html">table</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/type.html">type</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/updateable.html">updateable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Database%20Mapping/version.html">version</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Domain Classes</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/addTo.html">addTo</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/attach.html">attach</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/belongsTo.html">belongsTo</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/clearErrors.html">clearErrors</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/constraints.html">constraints</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/count.html">count</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/countBy.html">countBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/createCriteria.html">createCriteria</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/delete.html">delete</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/discard.html">discard</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/embedded.html">embedded</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/errors.html">errors</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/executeQuery.html">executeQuery</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/executeUpdate.html">executeUpdate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/exists.html">exists</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/fetchMode.html">fetchMode</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/find.html">find</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findAll.html">findAll</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findAllBy.html">findAllBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findAllWhere.html">findAllWhere</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findBy.html">findBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findOrCreateBy.html">findOrCreateBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findOrCreateWhere.html">findOrCreateWhere</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findOrSaveBy.html">findOrSaveBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findOrSaveWhere.html">findOrSaveWhere</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/findWhere.html">findWhere</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/first.html">first</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/get.html">get</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/getAll.html">getAll</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/getDirtyPropertyNames.html">getDirtyPropertyNames</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/getPersistentValue.html">getPersistentValue</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/hasErrors.html">hasErrors</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/hasMany.html">hasMany</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/hasOne.html">hasOne</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/ident.html">ident</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/instanceOf.html">instanceOf</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/isAttached.html">isAttached</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/isDirty.html">isDirty</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/last.html">last</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/list.html">list</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/listOrderBy.html">listOrderBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/load.html">load</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/lock.html">lock</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/mappedBy.html">mappedBy</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/mapping.html">mapping</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/merge.html">merge</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/namedQueries.html">namedQueries</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/properties.html">properties</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/read.html">read</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/refresh.html">refresh</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/removeFrom.html">removeFrom</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/save.html">save</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/transients.html">transients</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/validate.html">validate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/where.html">where</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/whereAny.html">whereAny</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/withCriteria.html">withCriteria</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/withNewSession.html">withNewSession</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/withSession.html">withSession</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Domain%20Classes/withTransaction.html">withTransaction</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Plug-ins</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/URL%20mappings.html">URL mappings</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/codecs.html">codecs</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/controllers.html">controllers</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/core.html">core</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/dataSource.html">dataSource</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/domainClasses.html">domainClasses</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/filters.html">filters</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/hibernate.html">hibernate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/i18n.html">i18n</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/logging.html">logging</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/scaffolding.html">scaffolding</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/services.html">services</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/servlets.html">servlets</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Plug-ins/web%20flow.html">web flow</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Services</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Services/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Services/scope.html">scope</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Services/transactional.html">transactional</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Servlet API</h1><div class="menu-sub"> |
| |
| |
| <div class="menu-item"><a href="../ref/Servlet%20API/request.html">request</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Servlet%20API/response.html">response</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Servlet%20API/servletContext.html">servletContext</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Servlet%20API/session.html">session</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Tag Libraries</h1><div class="menu-sub"> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/Usage.html">Usage</a></div> |
| |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/actionName.html">actionName</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/controllerName.html">controllerName</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/flash.html">flash</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/pageScope.html">pageScope</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/params.html">params</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/request.html">request</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/response.html">response</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/servletContext.html">servletContext</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tag%20Libraries/session.html">session</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| <div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">Tags</h1><div class="menu-sub"> |
| |
| |
| <div class="menu-item"><a href="../ref/Tags/actionSubmit.html">actionSubmit</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/actionSubmitImage.html">actionSubmitImage</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/applyLayout.html">applyLayout</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/checkBox.html">checkBox</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/collect.html">collect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/cookie.html">cookie</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/country.html">country</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/countrySelect.html">countrySelect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/createLink.html">createLink</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/createLinkTo.html">createLinkTo</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/currencySelect.html">currencySelect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/datePicker.html">datePicker</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/each.html">each</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/eachError.html">eachError</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/else.html">else</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/elseif.html">elseif</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/external.html">external</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/field.html">field</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/fieldValue.html">fieldValue</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/findAll.html">findAll</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/form.html">form</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/formRemote.html">formRemote</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/formatBoolean.html">formatBoolean</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/formatDate.html">formatDate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/formatNumber.html">formatNumber</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/grep.html">grep</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/hasErrors.html">hasErrors</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/header.html">header</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/hiddenField.html">hiddenField</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/if.html">if</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/img.html">img</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/include.html">include</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/isAvailable.html">isAvailable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/isNotAvailable.html">isNotAvailable</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/javascript.html">javascript</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/join.html">join</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/layoutBody.html">layoutBody</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/layoutHead.html">layoutHead</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/layoutTitle.html">layoutTitle</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/link.html">link</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/localeSelect.html">localeSelect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/message.html">message</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/meta.html">meta</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/pageProperty.html">pageProperty</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/paginate.html">paginate</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/passwordField.html">passwordField</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/radio.html">radio</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/radioGroup.html">radioGroup</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/remoteField.html">remoteField</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/remoteFunction.html">remoteFunction</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/remoteLink.html">remoteLink</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/render.html">render</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/renderErrors.html">renderErrors</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/resource.html">resource</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/select.html">select</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/set.html">set</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/setProvider.html">setProvider</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/sortableColumn.html">sortableColumn</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/submitButton.html">submitButton</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/submitToRemote.html">submitToRemote</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/textArea.html">textArea</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/textField.html">textField</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/timeZoneSelect.html">timeZoneSelect</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/unless.html">unless</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/uploadForm.html">uploadForm</a> |
| </div> |
| |
| <div class="menu-item"><a href="../ref/Tags/while.html">while</a> |
| </div> |
| |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| </td> |
| </tr> |
| </table> |
| |
| <div id="footer"> |
| Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. |
| Sponsored by <a href="http://springsource.com">SpringSource</a> |
| </div> |
| |
| <script type="text/javascript" src="../js/docs.js"></script> |
| |
| </body> |
| </html> |