Reputation: 56894
Here is my Config.groovy
's environments section (using 2.3.6):
grails.app.context = "/"
environments {
development {
grails.logging.jul.usebridge = true
grails.serverURL = "http://localhost:8080"
} production {
grails.logging.jul.usebridge = false
grails.serverURL = "http://myapp.example.io" // Although this isn't my production domain, it is a *.io TLD
}
}
When I do a grails -Dgrails.env=development run-app
I get:
| Error Error packaging application: Error loading Config.groovy: Cannot invoke method production() on null object (Use --stacktrace to see the full trace)
What's going on here?
Upvotes: 1
Views: 1394
Reputation: 50245
Use production
DSL in a new line. If used in the same line as the closure for development ends, then it is treated as a new method call on the return type of development
call (which is void) with a closure param. The method name being production
like:
development(clos1).production(clos2)
VERSUS
development(closure)
production(closure)
So use it as:
environments {
development {
grails.logging.jul.usebridge = true
grails.serverURL = "http://localhost:8080"
}
production {
grails.logging.jul.usebridge = false
grails.serverURL = "http://myapp.example.io"
}
}
Also, you do not need to specify the environment as development
for run-app, default environment is development, so just grails run-app
should suffice.
Upvotes: 3