Hi,
I'm attempting to implement a custom SCM, where I am using the git and
subversion plugins as examples on how to do this.
I'm currently stuck on setting the global options for my plugin. I made a
jelly template to set the 'sometoolPath' option. My understanding of the
@DataBoundConstructor and @DataBoundSetter was that this would cause these
to be called when the SCM implementation was configured:
public class MySCM extends SCM implements Serializable {
// Global configuration options - set from the GUI
private String sometoolPath;
@DataBoundConstructor
public MySCM() {
System.out.println("Instantiated new instance of MySCM!!!");
}
@DataBoundSetter
public void setSometoolPath(String sometoolPath) {
System.out.println("Updated path: " + sometoolPath);
this.sometoolPath = sometoolPath;
}
public String getSometoolPath() {
return sometoolPath;
}
...
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl) super.getDescriptor();
}
@Extension
public static final class DescriptorImpl extends SCMDescriptor<MySCM> {
public DescriptorImpl() {
super(MySCM.class, null);
load();
}
@Override
public SCM newInstance(StaplerRequest req, JSONObject formData)
throws FormException {
MySCM scm = (MySCM) super.newInstance(req, formData);
return scm;
}
@Override
public boolean configure(StaplerRequest req, JSONObject formData)
throws FormException {
save();
return true;
}
@Override
public String getDisplayName() {
return "My Cool SCM";
}
}
}
But no matter what I do, the setter function is not called.
For completeness, here is the content of MySCM/global.jelly:
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d=
"jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f=
"/lib/form">
<f:section title="${%Custom SCM Plugin}">
<f:entry field="sometoolPath" title="${%Path to command}">
<f:textbox default="customcommand"/>
</f:entry>
</f:section>
</j:jelly>
Thanks for any pointers anyone can give me.
Kind regards,
Berend Dekens
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/ce5e64b4-99b3-40c7-a25c-f407fb746d77n%40googlegroups.com.