Skip to content

Instantly share code, notes, and snippets.

@marc0der
Created April 4, 2011 16:07
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marc0der/901884 to your computer and use it in GitHub Desktop.
Save marc0der/901884 to your computer and use it in GitHub Desktop.
Install Grails on Ubuntu through LaunchPad
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails-ppa
#to add grails 2.0.x
sudo apt-get install grails 2.0.x
#to add grails 1.3.9
sudo apt-get install grails-1.3.9
#to add grails 1.2.5
sudo apt-get install grails-1.2.5
#switch between versions
sudo update-alternatives --config grails
@cazacugmihai
Copy link

First of all, thanks for this tool!
This is another script that can help grails developers:

Step 1: add this line to ~/.bashrc:

alias grails-link='source ~/grails-link.sh' 

Step 2: create ~/grails-link.sh with this content:

if [ -z "$1" ]; then
    echo "Usage: grails-link "
    exit
fi
 
BASE_DIR="/usr/share"
echo "Trying $BASE_DIR/grails-$1"
if [ -d "$BASE_DIR/grails-$1" ];
then
    export GRAILS_VERSION=$1
    export GRAILS_HOME=/usr/share/grails-$1
    
    sudo unlink "/etc/alternatives/grails"
    sudo ln -s "$BASE_DIR/grails-$1/bin/grails" "/etc/alternatives/grails"

    sudo unlink "/etc/alternatives/grails-debug"
    sudo ln -s "$BASE_DIR/grails-$1/bin/grails-debug" "/etc/alternatives/grails-debug"

    sudo unlink "/etc/alternatives/startGrails"
    sudo ln -s "$BASE_DIR/grails-$1/bin/startGrails" "/etc/alternatives/startGrails"

    echo "Linked up Grails $1..."
else
    echo "Not a valid Grails version..."
fi

@marc0der
Copy link
Author

Hi,

Thanks! Glad you like the package!

Don't know if you realise this, but the /etc/alternatives directory is actually reserved for use by the update-alternatives command on all Debian based Linux Distros (including Ubuntu).
Try:
man update-alternatives
for more info.

Cheers,
Marco.

@aeischeid
Copy link

very nice! the lack of easily switching grails versions was probably the main thing keeping me from using your package.

Also wondering how to check for existence of your bash completion script so it doesn't don't conflict with the one in the gedit-grails-bundle. Possibly you could help me learn how to make that bundle into a PPA that depends on yours, or something like that.

@marc0der
Copy link
Author

marc0der commented Jul 6, 2011

Thank you!

The old bash completion script won't work anymore because it relies on GRAILS_HOME, which no longer need be set in your environment. Would it be possible to remove the bash-completion script from your package and make mine the master?

I would love to help you make your stuff a package, and we could even make it a dependency of the metapackage if you like!
That's the grails-gedit bundle right?

@aeischeid
Copy link

Yep, https://github.com/aeischeid/gedit-grails-bundle

Removing bash completion from that would be fine, though I do wonder about non Debian users a little.

@marc0der
Copy link
Author

marc0der commented Jul 7, 2011

We could exclude it from the ppa package and leave it in the original bundle.
To me it just seems like it's not really related to gedit.

@fix
Copy link

fix commented Sep 23, 2011

i guess now you have grails 2.0.0 M2, instead of M1 now

@marc0der
Copy link
Author

Yeah sorry, the was serving 2.0.0 M2 but the docs still read 2.0.0 M1.

@panique
Copy link

panique commented Nov 6, 2012

Completely useless if you need an older version. Seriously, why is this so ridicolous hard to install this on linux ? sudo apt-get install grails-1.3.9 will install 1.3.9, but after first start of grails it updates to 2.x automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment