Grails, Travis CI, and Permission Denied

I was recently integrating Travis CI into my Grails CoffeeScript Compiler plugin, and ran into an odd problem. Since Google wasn’t very helpful, I thought I’d share the solution.

I started off with a very simple .travis.yaml file:

language: groovy
jdk:
 - oraclejdk7
branches:
 only:
 - master

script: ./grailsw refresh-dependencies
 && ./grailsw "test-app -integration"

When the build ran, I got an error message saying:

$ ./grailsw refresh-dependencies 
 && ./grailsw "test-app integration:" 
/home/travis/build.sh: line 147: ./grailsw: Permission denied 
The command "./grailsw refresh-dependencies" exited with 126.

Scratching my head, I ran to Google. Unfortunately, there were absolutely no results for “travis grailsw permission denied”. It took another 20 minutes of searching related terms before I finally discovered the answer. Looks like Travis can get hung up on file permissions (even though I’m on Windows, and thus don’t really have “execute permissions”). The simple solution is to manually alter the permissions on the Grails wrapper:

language: groovy
jdk:
 - oraclejdk7
branches:
 only:
 - master

before_script:
 - chmod +x grailsw

script: ./grailsw refresh-dependencies
 && ./grailsw "test-app -integration"

With that change in place, Travis builds and runs the tests successfully! Woo!

As a side note: once again, Grails astounds me. Look at that…I mean just LOOK at it! How much easier could it possibly be to add automatic CI builds to your Grails repository?! The answer is none. None more easier. ;-)

 

Brian has been developing web applications for over 14 years, primarily using Java, Groovy, .NET, ColdFusion, ExtJS, Flex, and AIR. He's worked as a consultant or employee on a wide range of projects for private companies and government agencies. Brian is a regular speaker at industry conferences, as well as a blogger and author. He has contributed to a number of community endeavors, including DeftJS, Swiz, Fusebox, ColdSpring, and several RIAForge projects.

Posted in Groovy/Grails
5 comments on “Grails, Travis CI, and Permission Denied
  1. Richard says:

    Brian, just encountered the same problem and your post saved me! Thank you.

  2. Brian Kotek says:

    Glad it helped, Richard!

  3. Christian says:

    Ditto to what Richard said!

  4. Guilherme says:

    It saved me a year later :)
    Thank you

  5. Rufer Marc says:

    Thanks a lot. Saved me some time to find it out myself ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>