Search code examples
grailsbuildgrails-orm

Grails - Minimum Installation for build


We have a defined a platform environment that includes specific Java, Ant, and Subversion versions. The idea is that someone with this platform can checkout any project in our repository, run a build command, and can build that project without downloading any software, or doing any specific setup in order for the build to work.

This is mainly done for my personal convenience (after all, I defined this platform). I run the Jenkins server, and want to be able to build any project without going through a lot of conniptions. Jenkins should be able to do a checkout and build without any specific instructions or environment setup.

If a special product is needed, I usually ask that this product be included in the project's directory structure. For example, if a project depends upon Ant-Contrib to build, the antcontrib.jar should be in the project, and the <taskdef> should point to that jar in the project.

We have one Grails project, and I was hoping there was some way I could include a minimal Grails installation in that project just to do build. All I have to run are the following commands:

  • grails clean
  • grails war

I understand that for development reasons, you may need a complete Grails installation, but I'm just interested in the build itself.

I was thinking of installing Grails inside the project, but I downloaded Grails, and in the grails/dist folder, there are 33 Grails jars. Under the lib folder, there are 300+ jars. Under the src folder, there are another 33 Grails jars. That's a wee bit too much to include inside the project as part of a checkout just so I can do a build.

Is there a compact subset that can be used just to run the build?

If not, I'll have to install Grails on our build server. This isn't too much of an issue, but it does mean that anyone who wants to build this project must first install Grails. Plus, I'll have to document that this project needs a special installation and how it's done and all other dependencies.


Solution

  • If your version of Grails is new enough (2.1 or newer), there is actually a built-in command to generate a wrapper script which can be used without having to have Grails installed, for exactly the purpose you mentioned.

    The documentation says:

    The Grails Wrapper allows a Grails application to built without having to install Grails and configure a GRAILS_HOME environment variable. The wrapper includes a small shell script and a couple of small bootstrap jar files that typically would be checked in to source code control along with the rest of the project. The first time the wrapper is executed it will download and configure a Grails installation. This wrapper makes it more simple to setup a development environment, configure CI and manage upgrades to future versions of Grails. When the application is upgraded to the next version of Grails, the wrapper is updated and checked in to the source code control system and the next time developers update their workspace and run the wrapper, they will automatically be using the correct version of Grails.

    See the complete docs here: http://grails.org/doc/2.1.0/guide/single.html#wrapper