-1

I am facing this particular error while configuring <properties> tag in config.xml

configure{ node -> 
node / builders / 'hudson.plugins.sonar.SonarRunnerBuilder' {
project('')
properties((sonar.projectName): "project")
javaOpts('')
additionalArguments('')
jdk('')
task('')
}
}     


**Error :**
ERROR: No such property: projectName for class: java.lang.String
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Anurag
  • 73
  • 8

2 Answers2

1

You can not use maps as element values in configue blocks. You need to provide a string to configure the properties element:

job('example') {
  configure{ node -> 
    node / builders / 'hudson.plugins.sonar.SonarRunnerBuilder' {
      project('')
      properties('sonar.projectName=project')
      javaOpts('')
      additionalArguments('')
      jdk('')
      task('')
    }
  }     
}
daspilker
  • 8,154
  • 1
  • 35
  • 49
  • I have tried this but It doesn't reflect in the job, I mean the tag doesn't get updated with the string that is being passed. This happens only with this particular tag @daspilker – Anurag Sep 26 '16 at 07:03
  • I can't reproduce that. If I change the line to `properties('sonar.projectName=project2')`, the job's config page shows `sonar.projectName=project2`. – daspilker Sep 26 '16 at 11:35
  • `groovy.lang.MissingMethodException: No signature of method: java.util.Properties.call() is applicable for argument types: (java.lang.String) values: [sonar.projectName=project]`. I am getting this error – Anurag Sep 27 '16 at 04:52
  • That means that you probably have a `properties` variable somewhere in your script. Try prefixing the line with `delegate.` like this: `delegate.properties('sonar.projectName=project')` – daspilker Sep 27 '16 at 15:05
  • Thank you. I never thought about this @daspilker – Anurag Sep 28 '16 at 09:35
0
configure {
        node->
        node / builders / 'hudson.plugins.sonar.SonarRunnerBuilder' {
            project('')
            properties('sonar.projectKey=automatizacion_base\nsonar.projectName=automatizacion_base\nsonar.projectVersion=1.0\nsonar.sources=.\nsonar.java.binaries=.')
            javaOpts('')
            additionalArguments('')
            jdk('')
            task('')
        }
    }