Grails war command defaults to development environment under netbeans - grails

When I generate the war in my grails app via right-click / run grails / command / war, it shows "Environment set to development", having it run without parameters. Why is this happening when according to the docs it should default to production (which is what I need)?
BTW, is there a way having built the whole grails application with NetBeans to use the command line to generate the wars ?
Versions: NetBeans 6.7.1, Grails 1.2
OS: Ubuntu 9.1
Thanks

The netbeans plugin is probably running the command "grails dev war" which creates a war file based on the development settings. The normal "grails war" command uses production settings.
You should just be able to change to the directory containing your grails-app and src folders and run the command
grails war
This assumes that you have grails installed and on your path.

No, only that grails war may assume it to be a development. I suggest you specifically type as follow:
grails prod war

you can modify the proyect file gradle.properties and add
org.gradle.jvmargs=-Dgrails.env=dev //for development
org.gradle.jvmargs=-Dgrails.env=prod //for production enviroment
Check https://docs.grails.org/latest/guide/gettingStarted.html

Related

which Build tool is used in grails?

which Build tool is used in grails?How a project war is created in grails,is it ANT or GRADLE build tool and how it is created using these build tools
Please read the document.You will find your answer.
http://grails.io/post/138665751278/grails-3-gradle-multi-project-builds .
You can build war simply "grails war " command .and for production "grails prod war"
Grails uses GRADLE build tool.
You need to specify the war name in the war command.
grails war project.war

How do I compile grails project using grails command line?

How do I compile my grails project? I want to get a .war file so I can deploy it.
First I installed JDK then I installed grails and I have properly set environment variables for both and checked it.Now I want to compile this grails project using grails command line.how can I do it?
Thanks in advance
If you type "grails help", you'll get a list of all the grails commands. The one you're looking for is "grails war"

How to build a custom environment in Grails

I'm trying to add a new environment to our Grails WAR (let's call it "staging"). I can manage the configuration in Config.groovy and DataSource.groovy and access the right configuration at run-time with -Dgrails.env, but how do I build this WAR?
The Grails documentation does not cover this case and the links on the page seem to be outdated.
You are so very close to having the right combination in your question, this should work:
grails -Dgrails.env=staging war
Actually, the documentation for the war command even uses 'staging' as the environment used.
The same goes for any environment-specific command:
grails -Dgrails.env=<environment name> <command>

Grails "war" command, how to set system property

I'm running grails prod war to create my app's .war file. The problem is, I need to somehow set a system property that can be accessed in grails-app/conf/Config.groovy when that .war is being built.
How can I do this? Grails version 2.1.0
You need to set this property when the war is being launched, not when it's being built. If the app is being hosted by Tomcat (or similar) you would typically adds this as a parameter to the java command that launches Tomcat.
grails -Dproperty=value prod war

Grails War and deploy

I am using grails 1.3.4 on windows xp and centos. Tomcat 5 on centos.
I do a 'grails dev war' and 'grails prod war' on an app (as well as a test app I've put together). I take the war file on xp and expand it in another dir. On the centos I can put the war file in tomcat and also in it's own dir. But when I go to run-war or run-app the unpacked war files, I am told my app is pre-0.5 grails. I do a grails upgrade. But then when I go to run-app or run-war again I get 0 domains 0 controllers and nothing is available.
My app before I war the files is 1.3.4 and it's runs, passes tests and full functions, but not once I war it. Any ideas?
You can't use run-app or run-war on unpacked war files. Both are meant to be used from the source project itself. run-app runs directly with an embedded Tomcat (or Jetty if you switch to that plugin) and run-war builds a war and deploys it into an embedded Tomcat.
When you build a war (whether you unpack it or not) it's to be used by Tomcat or another servlet container directly, not as a 'Grails war' but as a war like any other.
Basically your options are:
'grails run-app' from the project root to test in dev mode
'grails prod run-war' from the project root to test a war in prod mode
'grails war' to deploy to a standalone container and run as a deployed application
If you are using datasource check that your username and password are correct for database connections

Resources