2

I'm pretty new to the Grails Framework and I'm experiencing some strange behavior. If I use the grails commandline tool this way

grails "-DghprbPullTitle=Title with spaces" clean

grails fails with this error message

| Script 'With' not found, did you mean:
   1) IntegrateWith
   2) Init
   3) CreateUnitTest

Starting grails this way will work

grails "-DghprbPullTitle=Title_without_spaces" clean

Ok one can now say "Then just avoid spaces" The problem is, that this occurs while I'm using Jenkins + Grails Plugin + Pull Request Builder Plugin. The Pull Request Builder Plugin generates some of these parameter with whitespaces.

Any thoughts how I can use grails with such whitespace-containing parameter. Or how I can tell the Pull Request Builder Plugin no to generate such parameter.

Maven on the other hand is able to handle such parameter.

Thanks in advance, Marco

marco
  • 195
  • 2
  • 8
  • Are you able to get the args if `grails -DghprbPullTitle='Title with spaces' clean` or `grails -DghprbPullTitle="""Title with spaces""" clean` is used. Have not tested it, give it a shot. – dmahapatro Apr 25 '14 at 13:55
  • Unfortunately both variants causing the same error. Nethertheless I wouldn't be able to tell the Pull Request Builder Plugin to generate parameter like this :( – marco Apr 25 '14 at 14:02
  • I use grails with version 2.3.7 – marco Apr 25 '14 at 14:07
  • Is there a workaround to get `ghprb` pluging working with `grails` plugin? – pavel Sep 25 '14 at 12:42

4 Answers4

1

I ended up using shell builder with grailsw call instead of the Grails plugin.

pavel
  • 2,964
  • 2
  • 14
  • 14
0

Ok so it was a bug in the grails commandline tool. It will be fixed in grails 2.4-RC1. See Grails Issue Tracker

marco
  • 195
  • 2
  • 8
  • It still exists in Grails 2.4.3 and it looks like it was there at least from 2.2.1, probably even earlier. – pavel Sep 25 '14 at 12:44
0

The problem is that Grails Plugin + Pull Request Builder Plugin makes it pass build parameters from PR Builder plugin to grails commands. Those arguments with spaces are not required for build to happen, it's some kind of default in Grails Plugin to pass those parameters along to grails commands.

If Grails Wrapper on Grails Plugin didn't work for you, using Shell commands instead of Grails Plugin worked for me: it avoids parameters with space and makes GitHub notifications to work. It's worse for grails installations maintenance, but at least it's an alternative.

0

I submitted a PR https://github.com/jenkinsci/grails-plugin/pull/12 to work around this by suppressing the -D build environment variables.

I am using the Github pull request builder plugin https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin to run test-app and was running into the same issues as others. I am not using any of the variables that the ghprb plugin passes in so I added an option to suppress -D build environment variables. When this option is checked none of the -D variables are passed to grails allowing the build with grails plugin to run the targets as expected.

If you want to test it out to see if it works for you, you can download it from here http://jmoses.co/data/grails.hpi and install it manually How to install a plugin in Jenkins manually?

Community
  • 1
  • 1
John Moses
  • 1,283
  • 1
  • 12
  • 18