snipt

Ctrl+h for KB shortcuts

Text only

Grails Tip: Enable SQL Logging

1
2
3
4
5
6
7
8
Grails Tip: Enable SQL Logging
development {
   dataSource {
       dbCreate = "create-drop" // one of 'create', 'create-drop','update'
       url = "jdbc:hsqldb:mem:devDB"
       loggingSql = true              
   }
}
https://snipt.net/embed/0a2ce7296e476c67714ae3a3a996888c/
/raw/0a2ce7296e476c67714ae3a3a996888c/
0a2ce7296e476c67714ae3a3a996888c
text
Text only
8
2019-05-18T07:39:43
True
False
False
/api/public/snipt/16900/
grails-tip-enable-sql-logging
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Grails Tip: Enable SQL Logging </span><span id="L-2"><a name="L-2"></a>development { </span><span id="L-3"><a name="L-3"></a> dataSource { </span><span id="L-4"><a name="L-4"></a> dbCreate = &quot;create-drop&quot; // one of &#39;create&#39;, &#39;create-drop&#39;,&#39;update&#39; </span><span id="L-5"><a name="L-5"></a> url = &quot;jdbc:hsqldb:mem:devDB&quot; </span><span id="L-6"><a name="L-6"></a> loggingSql = true </span><span id="L-7"><a name="L-7"></a> } </span><span id="L-8"><a name="L-8"></a>} </span></pre></div> </td></tr></table>
grails

Text only

grails - create a new mavenized 1.3.2 project

To create a new mavenized 1.3.2 project, this is the archetype command to use:
mvn archetype:generate -DarchetypeGroupId=org.grails -DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=1.3.2 -DgroupId=example -DartifactId=my-app
https://snipt.net/embed/5dd030d9570540d51f5f4239598abf31/
/raw/5dd030d9570540d51f5f4239598abf31/
5dd030d9570540d51f5f4239598abf31
text
Text only
2
2019-05-20T08:01:16
True
False
False
/api/public/snipt/16891/
grails-create-a-new-mavenized-132-project
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>To create a new mavenized 1.3.2 project, this is the archetype command to use: </span><span id="L-2"><a name="L-2"></a>mvn archetype:generate -DarchetypeGroupId=org.grails -DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=1.3.2 -DgroupId=example -DartifactId=my-app </span></pre></div> </td></tr></table>
grails, maven

Bash

set Grails path

export GRAILS_HOME="/opt/local/share/java/grails"
https://snipt.net/embed/de455c9de7396f3f263ea27dc2c76a3b/
/raw/de455c9de7396f3f263ea27dc2c76a3b/
de455c9de7396f3f263ea27dc2c76a3b
bash
Bash
1
2019-05-20T16:40:09
True
False
False
/api/public/snipt/3595/
set-grails-path
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">export</span> <span class="nv">GRAILS_HOME</span><span class="o">=</span><span class="s2">&quot;/opt/local/share/java/grails&quot;</span> </span></pre></div> </td></tr></table>
bash, grails

Bash

run Grails app on specific port

## change 9090 to whatever available port you want to use
grails -Dserver.port=9090 run-app
https://snipt.net/embed/add373743b3b906ec2bf73ed6a29eafb/
/raw/add373743b3b906ec2bf73ed6a29eafb/
add373743b3b906ec2bf73ed6a29eafb
bash
Bash
2
2019-05-22T22:48:15
True
False
False
/api/public/snipt/3594/
run-grails-app-on-specific-port
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">## change 9090 to whatever available port you want to use</span> </span><span id="L-2"><a name="L-2"></a>grails -Dserver.port<span class="o">=</span><span class="m">9090</span> run-app </span></pre></div> </td></tr></table>
bash, grails, port