Greetings of the day !
I have a requirement to check the environment in grails project Java source package. Please help me.
I am trying to use this code, but not getting success.
String envName = System.getProperty(Environment.DEVELOPMENT);
Try this to get the current environment--
import grails.util.Environment;
...
Environment.getCurrent()
or test the environment --
Environment.getCurrent() == Environment.DEVELOPMENT
Related
I was using 3.0.14v Grails and I did some deployments to heroku. Everything was working fine, however I wanted to try with Grails 3.1.1 and I'm getting some errors now.
I was following this post https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku
I cloned this https://github.com/kissaten/grails3-example
I think it's something about tomcat version but not sure.
Any help?
For your trouble with the compile 'com.github.jsimone:webapp-runner:8.0.30.1', I figured it out by removing the httpclient module from all test* import, and I imported a good version of that module (only for test*).
testCompile ("org.grails.plugins:geb"){
exclude module: 'httpclient'
}
testCompile ('org.seleniumhq.selenium:selenium-firefox-driver:2.48.2'){
exclude module: 'httpclient'
}
testCompile 'org.apache.httpcomponents:httpclient:4.3.5'
Thanks to that, I could import the "last" webapp-runner (directly as a jar)
compile 'com.github.jsimone:webapp-runner:8.0.30.1#jar'
Maybe that version of the webapp-runner will fix the problem, but I'm not sure.
As I saw on your stacktraces, there is a NoClassDefFoundException for org/apache/tomcat/util/descriptor/tld/TldParser.
This class is provided by the tomcat-embed-core artifact. And that artifact comes from spring-boot-starter-tomcat (as a dependency). Change "spring-boot-starter-tomcat" from provided to compiled or try another version (for Grails 3.0.9, the spring-starter-tomcat version is 1.2.6).
Hope it helps ;)
I'm unsure of the specifics, but it looks like Grails 3.1.1 requires some of the classes in the Tomcat 8.x line.
I found a solution
I used a "compile 'com.github.jsimone:webapp-runner:8.0.30.2'" instead '8.0.30.1' and It's working well now.
I think there is an issue with including '8.0.30.1' as a compile time dependency.
I have followed the documentation with regards to setting Grails up on Windows, but for some reason it is not working. Any help would be much appreciated
Check out this solution:
shortly: just run once grails create-app myApp
I have to create new application based on Groovy and Grails, versions are-
grails-2.3.6
groovy-2.1.9
For this what configuration is most suitable please help me...
GGTS, STS or Eclipse
java6, java7 or java8
I tried everything but no one combination is smooth and flawless for me. I got lots of error in each combination which I tried like
I tried these sets-
GGTS 3.5.1 and java7,java6
STS and java7,java6
Eclipse juno and java7,java6
I am new to this platform please help me out. thanks.. :)
I'm developing a sample grails application which runs in different environment. I will pass the environment name as runtime argument like below,
grail run-app –Denv=dev1
grail run-app –Denv=dev2
I need to get the environment name dev1 or dev2 programatically. I'll be using the values in GSPs. Kindly help. Thanks.
You can use grails.util.Environment :
println Environment.currentEnvironment.name
I have recently started to work with grails. I was able to create applications and generate stuff. Yesterday I wanted to resume my work, after a little break and ran into the following error, when trying to create a new project:
Command terminated with an exception:
org.grails.ide.eclipse.longrunning.client.GrailsProcessDiedException: Grails process died
(see details for partial output)
Grails process died
------System.out:-----------
------System.err:-----------
This error only occurs when I use the SpringSourceTool, if I try using the command line it works fine. My first reaction was to change the java version from 1.8 to 1.7, but that didn't help. My environment variables look like this (I am running Fedora Linux 19)
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.0.x86_64
GRAILS_HOME=/home/peer/grails/grails-2.3.0
They are also included in the PATH variable.
Can anybody help? Thanks, Peer
This is a known issue in STS:
https://issuetracker.springsource.com/browse/STS-3277
A work-around is provided in the link.
For anyone pulling their hair out trying to create a grails project using the STS extension for Grails, here is my setup and following is what I did to get it working:
-- OSX 10.8.4 Build 12E3067 --
-- STS Version 3.4.0 --
-- Grails 2.3.3 (installed separately to STS) --
Fresh installed STS 3.4.0
I *de*selected the Preferences/Groovy/Compiler/Enable checking for mismatches between
project and workspace Groovy compiler levels
I ONLY selected the Grails Support option when installing the extensions (nothing else)
Restart STS 3.4.0 (i.e. restart eclipse)
I then pointed my Grails project to my existing Grails 2.3.3 installation
Make sure that the environment variable GRAILS_HOME is set and exported in the same
shell from which you invoke STS otherwise you will get a process termination error in
Eclipse (STS)
This worked.