Building a grails project in hudson
I’ve learned how to set up setup grails and how to install hudson on Ubuntu 10.10 Server. Now I want to use hudson to build my grails project.
Before we set up the project, we need to install some plugins. Access your hudson admin interface, probably at http://<hostname>:9090
Go to Hudson -> Manage Hudson -> Manage plugins -> Available (it’s a tab) and get these required plugins:
Hudson Mercurial plugin or get the one for git/svn/cvs depending on what you use. I’m a mercurial fan.
If you like, you can also install some of these, but they’re not required:
After that you need start a new project by going to the link called Hudson -> New project
Choose a job name, and the Build a free-style software project. After you click OK, you get a lot of options. Only some of them are needed:
Discard Old Builds -> Days to keep: 3, Max # of builds to keep: 10
In the Source Code Management part you select Mercurial and then enter the Repository URL. For a private bitbucket it’s like this:
https://<username>:<password>@bitbucket.org/<username>/<project>
Make sure to include the username:password if it’s a private project. For a public one, it’s not needed.
In the Build Triggers section, choose Poll SCM and enter this into the schedule field (it’s std cron notation):
# every minute
* * * * *
In the Build section, choose Add Build Step and Build With Grails. You’ll se a lot of grails related fields but you only need to enter the following into the Targets field:
test-app
Eventually, you’ll probably want to run some other targets, but this one is a good starter.
In the Post-build Actions section, select the Publish JUnit test result report. Enter the following into the Test report XMLs field:
target/test-reports/*.xml
You’re almost done, just click Save in the bottom.
Now run the project and check the outcome. After two runs, you should start to see a unittest graph.
Make a change to your code, push to the repo and see if hudson picks it up. It should poll once every minute and pick up the code change and start a build automatically
[...] set up my grails build on Hudson, and now I want to deploy to my Tomcat server. Every time my tests complete, I want a new deploy. [...]
Deploying from grails to tomcat « makeitfaster
December 20, 2010 at 14:18