A New Gradle Grails Plugin

My team wanted to use Gradle to build our Grails project.  We had some trouble with version compatibility problems between Grails and the Grails build plugin, though.  Instead of using the plugin, we tried writing some code that called the ‘grails’ command directly, but that caused problems with the CI server because it required that the correct version of Grails be preinstalled on all build servers and exist in a known location.  I decided to try my hand at writing a simpler Grails build plugin and this is what I came up with.  It doesn’t require Grails to be pre-installed on the machine and, since it just executes the ‘grails’ command, it works with any version.

Fork it!  Or just use it 🙂

Gradle Grails Wrapper

Posted in Gradle, Groovy by Connor Garvey at April 6th, 2012.
Tags: , , , , ,

5 Responses to “A New Gradle Grails Plugin”

  1. Olaf Geibig says:

    Great plugin, I’m using ist for production. With the other grails plugin I wasted hours to make it work with Grails 2.0.3 (May 2012) and after I made it was work the war file was incomplete. You plugin is much simpler and more robust. Just one thing I would like: Please add – if possible – inputs and outputs so that the grails tasks are aware of up to date checks.

    • Hi Olaf. Thanks for the idea. I don’t think I understand, though. Do you mean that the Gradle build should be aware of when the Grails build is up-to-date? I’d be happy to add that if I can figure out how 🙂

  2. Morten says:

    Seems like a very good idea. However, when I try the plugin I get this exception:

    org.apache.commons.vfs2.FileSystemException: Could not find file with URI “/Documents and Settings/mohi/.gradlegrails/grails/2.0.2\bin” because it is a relative path, and no base URI was provided.
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:719)
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)
    at org.apache.commons.vfs2.FileSystemManager$resolveFile.call(Unknown Source)
    at com.connorgarvey.gradlegrails.GrailsPlugin.unzipGrails(GrailsPlugin.groovy:193)

    Apparently it tries to load Grails from my home directory without a proper file:// protocol – or could it be the spaces in ‘Documents and Settings’? I am not sure.
    I may try forking the project and changing it, but I haven’t tried building a Grdale plugin before, so I am unsure about how to incorporate it in my build…

    • Thanks for the note. Someone filed the same issue with the GitHub project. I had to get set up on a Windows computer to fix this. I have yet to write automated tests for the plugin, but in my limited manual testing, everything worked except interactive prompts. I’ll work on that next. Please update to 0.4.1 and let me know if you have any more problems.

Leave a Reply