How to pass arguments to Grails in command line? - grails

I'm trying (Grails 1.3.7):
grails tomcat deploy -Dtomcat.deploy.username=abc
With no effect. Is it a correct syntax? I can't find it in documentation...

Have you tried moving the -Dtomcat.deploy.username=abc to be right after grails in the command? i.e.:
grails -Dtomcat.deploy.username=abc tomcat deploy
Two reasons why I suggest this:
In the past, I know I've had trouble declaring -D properties at the end of the command (like you're observing).
I know that grails -Dserver.port=xxxx run-app does work, since I use it often, and that's using the -D before any other arguments to grails.

Related

Grails: how to define configuration profile when launching grails war with java command?

I have a grails 3.0 application packaged as war file, and I would like to run it with java command line. Things looks simple from the reference guide: java -jar my_war_file_name. But I cannot find a way to pass in the profile (dev/test/prod), and also it looks like -D option cannot overwrite the configuration as well. Any idea?
Best Regards
Sorry, I found the problem. I should put -D in front of -jar. So this is working:
java -Dgrails.env=prod -Dserver.port=xxxx -jar my_war_file

Grails/aNimble on Windows : Getting cannot find the specified path

I am trying to setup aNimble on Windows following this article.
I have setup the Java and MySQL (xampp) on Windows and both are working properly.
Now, as the final step I need to execute
grails prod execute-database-scripts-all
but I am getting cannot find the specified path. Even when I type grails only I get the same error. I have zero experience in Grails, but it seems that I need to install Grails first on the PC. Until I do this, I want to know is there anything else that I need to do this to successfully execute this command.
What are the three portions of this command grails, prod and execute-database-scripts-all
This error means that Windows is unable to find grails executable anywhere it looks (in any paths specified in PATH system property) when you typing grails command. You may have to follow this guide in order to install grails application framework properly in your system (also, make sure you are installing a correct version of grails compatible with your distribution of aNimble) and then retry.
Grails is a web application framework and which provides a set of tools to develop, build and run web applications like aNimble, prod is a command line option for grails telling it to run in a production mode and execute-database-scripts-all is aNimble-specific command to initialize it's database.

grails v3.0.0.M1 - I can create a script, but not sure how to run it

I started trying to have a peek at grails v3.0.0.M1.
I unpacked and setup and created an app
When creating a script by using folowing command
grails create-script my-script
it creates a script and drops the hyphen - so script is myscript.groovy. Thought it might camel case that. More importantly - how do you run it?
In the grails command line prompt when I go help - the new script is not visible. If you try grails> my-script, it fails with
Error command not found my-script...
Having created a script - how do you run it?
Given a script named myscript.groovy, run it as
grails myscript
I haven't looked at the code, but it seems like a bug that it's dropping the hyphen. You should create an issue at https://jira.grails.org/browse/GRAILS/. It's easy to fix though, just rename the file to my-script.groovy and then you can run
grails my-script

'Grails shell' not working on Grails.3.0.0.M1

Following instructions from official doc :
http://grails.github.io/grails-doc/latest/ref/Command%20Line/shell.html
Command:
grails shell
on a Grails 3.0.0.M1 project doesn't exist.
Any idea why ?
As of now shell simply is not implemented. The docs refer to lots of things from 2.4, that might not (or even never) be in 3.0.
You could use console for now. it is (more or less) the shell using swing.
Don't forget: 3.0.0.M1 right now is just a milestone. Far from production ready or complete.

what happened to 'generate-all' command in Grails 2.3.8?

Started a brand new project based on grails 2.3.8 (groovy 2.2.2) and I can't figure out what happened to 'generate-all' command. I have a domain class set up, i was able to create the controller but it beats me to find how views get crated now.
I've gone through the crate-app step and crated 1 domain class. Am I missing a plugin or something? When I look at tutorials they sure refer to the 'geneate-all' command.
Have things changed that much?
Typically in 2.3.x when you first create the project "generate-all" needs to have a series of Grails compile, clean, clean-all and refresh-dependency. Failing that, exit the project and restart. Then it will show as a valid command.
The reason for this is in 2.3.x scaffolding was moved into a plugin and it needs to be compiled first before the command is available.

Resources