Groovy console can’t “remember” any variables – always says “unknown property”

This is standard behavior in the Groovy shell, not peculiar to the Grails shell. You probably don’t want to def the variable. See the following: ~ $ groovysh Groovy Shell (2.3.4, JVM: 1.7.0_45) Type ‘:help’ or ‘:h’ for help. ——————————————————————————- groovy:000> def x = 42 ===> 42 groovy:000> x Unknown property: x groovy:000> y = … Read more

Grails 2.3.0 Auto-reloading not working

It seems that in Grails 2.3 the reloading is no longer the default In Grails 2.3 the reloading agent is no longer on the build system path unless you pass the -reloading flag to the grails command: grails -reloading run-app However, you can enable forking in your buildConfig using the following configuration: forkConfig = [maxMemory: … Read more

Inject grails application configuration into service

The grailsApplication object is available within services, allowing this: package example import com.example.ExampleApiClient; class ExampleService { def grailsApplication def relevantMethod() { def client = new ExampleApiClient( grailsApplication.config.apiCredentials.baseUrl grailsApplication.config.apiCredentials.username, grailsApplication.config.apiCredentials.password ) return client.action(); } }

Are there any good tutorials for using sitemesh in a grails application?

the g:pageProperty is a very powerful, but very poorly documented thing. Lets say in my layout I specify where to put some content like this: <html> <body> <g:pageProperty name=”page.header” /> </body> Now in my page I can specify some content: <content tag=”header”> <!– header –> </content> Sitemesh will take the content tag, regardless of actual … Read more

What does the question mark mean in GSP/Grails?

It’s the “Safe Navigation Operator”, which is a Groovy feature that concisely avoids null pointer exceptions. See http://docs.groovy-lang.org/latest/html/documentation/index.html#_safe_navigation_operator In this case, if phoneInstance is null, then it doesn’t try to get the name property and cause a NPE – it just sets the value of the field tag to null.

IntelliJ IDEA Debugger isn’t working on a Grails Project

I have tried all mentioned here without success. The only helpful information is here. In essence you should disable forked execution by adding the following to grails-app/conf/BuildConfig.groovy: grails.project.fork = [ test: false, run: false ] Now debugging is available in IntelliJ IDEA Ultimate Edition v.12.1.6 just by ordinary Debug without Remote debugging. Tested on Grails … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)