0

I have created two Hudson String Parameters in my parametrized build configuration: svnRoot, and svnBranch.

I can reference these just fine when specifying my Repository URL: ${svnRoot}/${svnBranch}/subProject.

But I have not been able to reference them as part of my Grails Build Target: "build-applet ${svnRoot}/${svnBranch}/appletProject username password" "war --non-interactive". build-applet invokes a Gant script in the Grails project at scripts\BuildApplet.groovy. This attempt yields the following error:

groovy.lang.MissingPropertyException: No such property: svnRoot for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:240) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:561) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:536) at com.g2one.hudson.grails.GrailsBuilder.evalTarget(GrailsBuilder.java:212) at com.g2one.hudson.grails.GrailsBuilder.perform(GrailsBuilder.java:168) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:603) at hudson.model.Build$RunnerImpl.build(Build.java:172) at hudson.model.Build$RunnerImpl.doRun(Build.java:137) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417) at hudson.model.Run.run(Run.java:1337) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:140)

What is the best and or easiest way to achieve my goal?

Stephen Swensen
  • 22,107
  • 9
  • 81
  • 136

1 Answers1

1

From looking at the wiki page on the Grails plugin (http://wiki.hudson-ci.org/display/HUDSON/Grails+Plugin), this should work

grails build-applet ${env.svnRoot}/${env.svnBranch}/appletProject username password

If not, I'd try a command line build step. Make sure you set GRAILS_HOME as the first line in the script then call grails.

cheers

Lee

leebutts
  • 4,882
  • 1
  • 23
  • 25
  • Thank you @leebutts! Your code example didn't quite work but it set me on the right path. First, looking at the documentation you linked, I saw that you forgot to add single quotes around `svnRoot` and `svnBranch` in your example. But even after making that fix, the script choked on `[` when using `System.properties["grails.cli.args"]?.tokenize()` to parse the args. However, using dot notation to dereference the `env` variables worked perfectly: `grails build-applet ${env.svnRoot}/${env.svnBranch}/appletProject username password`. Feel free to update your answer. – Stephen Swensen Dec 29 '10 at 18:41