Is this an appropriate place to ask this kind of question?

---------- Forwarded message ----------
From: Guy Matz <>
Date: Tue, Mar 6, 2018 at 5:34 PM
Subject: Using StaplerRequest to configure a plugin?

Hi!  Does anyone know how to automate the configuration of a plugin using a
StaplerRequest object?  I'm trying to configure scm-sync-configuration with:

import net.sf.json.JSONObject
import org.kohsuke.stapler.StaplerRequest
import hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin

def params = [
                noUserCommitMessage: false,
                displayStatus: true,
                scm: 'hudson.plugins.scm_sync_configuration.scms.
                gitRepositoryUrl: '',
                commitMessagePattern: '[message]',
                manualSynchronizationIncludes: 'asdfasdf'

def JSONObject formData = [ params ] as JSONObject

scm = new ScmSyncConfigurationPlugin().getInstance()
println("SCMs? ${scm.getScms()}")

StaplerRequest req = [
  getParameter: { name ->
    // println(params[name])
] as org.kohsuke.stapler.StaplerRequest

scm.configure(req, formData)

It seems to almost work a little - uncommenting "println(params[name])"
tells me that it's getting processed a bit - but then it bombs with:

at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(
at org.codehaus.groovy.runtime.ConversionHandler.invoke(
at com.sun.proxy.$Proxy51.getParameterValues(Unknown Source)
at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin.

The source at line 218 of ScmSyncConfigurationPlugin is:
if(req.getParameterValues("manualSynchronizationIncludes") != null){

Any thoughts out there?  :-(

You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit
For more options, visit

Reply via email to