DEV@cloud » Continuous Integration with Grails and Jenkins

Continuous Integration with Grails and Jenkins

Last modified by Cyrille Le Clerc on 2013/04/26 15:34

How to create a Grails build with Jenkins and Grails Wrapper

error Using the Grails Wrapper to build a project is significantly slower than using a pre-installed Grails SDK as described in the "How to declare a Grails SDK in Jenkins" chapter.

Details on Grails Wrapper are available at The Grails Framework - Reference Documentation - Grails Wrapper.

1. Click on Builds

01-goto-builds.png

2. Click on Manage Jenkins

02-goto-manage-jenkins.png

3. Click on Manage Plugins

03-goto-manage-plugins.png

4. Ensure that the Grails plugin is enabled

04-installed-plugins.png

...

05-installed-plugin-grails.png

5. Create a Free Style Job

10-create-free-style-job.png

6. Add a "Build With Grails" step using Grail Wrapper

11-build-with-grails.png

12-build-with-grails.png

error Warning, using the "Grail Wrapper" to build the application requires the prior installation of this Wrapper (see Grails Documentation > The Wrapper). 

8. Add a post build action "Deploy Application" 

13-deploy-application.png

Try with CloudBees Grail PetClinic ClickStart!

This ClickStart will 

  1. Create a git repository on CloudBees Forge forking a GitHub version of Grails PetClinic,
  2. Create the Jenkins to build the project which will automatically deploy successful builds on a server,
  3. Create a MySQL database,
  4. Deploy the Grails PetClinic application on a CloudBees Tomcat container associated with the database,

Press the button to build, test and deploy this instantly:

How to declare a Grails SDK in Jenkins

If you don't use the Grails Wapper, you will need to declare a Grails SDK in your Jenkins configuration.

1. Click on "Manage Jenkins"

06-goto-manage-jenkins.png

2. Click on "Configure System"

07-goto-configure-system.png

3. Scroll down to Grails and click on "Grails installations..."

08-add-grails-sdk.png

4. Declare the Grails SDK with the needed version

09-declare-grails-sdk.png

FAQ

My build fails with  a IOException: Cannot run program "grails"

[grails-petclinic-clickstart] $ grails clean --non-interactive
FATAL: command execution failed
java.io.IOException: Cannot run program "grails" (in directory "/scratch/jenkins/workspace/grails-petclinic-clickstart"): error=2, No such file or directory
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
 ...
Caused by: java.io.IOException: error=2, No such file or directory
 at java.lang.UNIXProcess.forkAndExec(Native Method)
 ...
Build step 'Build With Grails' marked build as failure
Finished: FAILURE

You are probably configured the grails build to not use the Grails Wrapper and the local "Grails installation" has a problem or there is no local Grails installation.

faq-02-grails-build-without-wrapper.png

faq-01-grails-build-select-sdk.png

Please verify that the Grails SDK you need for your job is properly configured at the Jenkins global configuration level. See How to declare a Grails SDK in Jenkins.

Special Thanks

Special thanks to Aurélien Maury from Xebia for his help!

Tags:
Created by Cyrille Le Clerc on 2013/04/25 21:24