Grails

From Blue-IT.org Wiki

Grails Tools Suite or Spring Tools Suite

Ubuntu 19.10

[Update 03/2020] Ubuntu 19.10 - WebUpd8 repo discontinued, use linuxuprising repo

First completety remove the java stack in ubuntu!

apt-get update
apt-cache search java | awk '{print($1)}' | \
grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' \
-e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' \
-e 'java-common' | xargs sudo apt-get -y remove
apt-get -y autoremove

Then install the right java version from oracle with thhe ppa of webupd8, it should be JAVA 1.7.

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java13-installer
sudo apt install oracle-java13-set-default


Now you can download the Eclipse, STS or GGTS version for your pc (AMD64 oder x86). The architecture is very important! So if you are using an Ubuntu 64bit system you MUST install also download the according 64bit version! This is NOT mandatory!

If you downloaded it to a dirrectory /local/share - like me - create a startscript somewhere like this:

e.g. for Eclipse

#!/bin/sh
export GDK_NATIVE_WINDOWS=true
export LIBOVERLAY_SCROLLBAR=0
cd /local/share/eclipse
env UBUNTU_MENUPROXY= /local/share/eclipse/eclipse eclipse

e.g. for STS

#!/bin/sh
export GDK_NATIVE_WINDOWS=true
export LIBOVERLAY_SCROLLBAR=0
cd /local/share/springsource/sts-3.4.0.RELEASE
env UBUNTU_MENUPROXY= /local/share/springsource/sts-3.4.0.RELEASE/STS STS

You can create a launcher for ubuntu which then starts this scripts. This method is more felexible applying VARS for starting the development environment, then putting everything in das .desktop file.

The corresponding icon for your release you alsway find in the root of the whatever-X.X.X.RELEASE and it is simmply called icon.xpm ;-)

Installation

First of all: install sun(oracle)-java 1.6 and remove all openjdk packages (or at least be shure to run update-alternatives --config java).

Ubuntu way

http://www.grails.org/Installation

http://www.grails.org/Download

sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails

#to add grails 2.0.0 M1
sudo apt-get install grails-2.0.0 

#to add grails 1.2.5
sudo apt-get install grails-1.2.5

#switch between versions
sudo update-alternatives --config grails

That's it !

Manual

http://www.grails.org/Installation

http://www.grails.org/Download

Download an install grails into a directory.

Then edit your ~/.bashrc file or use export to set the variables in the running shell / environment:

export PATH="$PATH:/local/share/grails/bin"
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
export GRAILS_HOME="/local/share/grails"

Logging

web-app/WEB-IF/log4j.properties

log4j.rootLogger=INFO, console

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %-5p %c - %m%n

# debug plugin
#log4j.logger.grails.app.filters='info'
#grails.debug.productionOverride=anything

#log4j.category.org.springframework=DEBUG
#log4j.category.com.opensymphony.webwork=DEBUG
#log4j.category.com.opensymphony.xwork=DEBUG

Debug

tail -f /project/stacktrace.log

Context

Setting context to "/"

1. web-app/application.properties

app.context=/

2. Config.grooy

production {
   grails.app.context = "/"