This article addresses how to create a Grails build with Jenkins and the Grails Wrapper.
WARNING: 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. Details on the Grails Wrapper are available at The Grails Framework - Reference Documentation - Grails Wrapper.
1. Click on Builds
2. Click on Manage Jenkins
3. Click on Manage Plugins
4. Ensure that the Grails plugin is enabled
5. Create a Free Style Job
6. Add a "Build With Grails" step using Grail Wrapper
Warning, using the "Grails Wrapper" to build the application requires the prior installation of this Wrapper (see Grails Documentation > The Wrapper).
7. Add a post build action "Deploy Application"
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"
2. Click on "Configure System"
3. Scroll down to Grails and click on "Grails installations…"
4. Declare the Grails SDK with the needed version
[grails-petclinic] $ grails clean --non-interactive FATAL: command execution failed java.io.IOException: Cannot run program "grails" (in directory "/scratch/jenkins/workspace/grails-petclinic"): 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 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.
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.