I'm not sure if Jenkins finds the correct mapping if you use underscores in your identifier names (Java and Jelly). Can your retry without?
Ulli Am 09.01.2013 um 16:50 schrieb [email protected]: > Hello. > > Please bear with me, as I've only been working with Jenkins for a > couple of days and am not yet familiar with the code and/or associated > libraries. > > I'm trying to write a plugin to allow the use of the Fossil SCM > (http://fossil-scm.org). > > I've defined a few configuration values for a given job (in > src/main/resources/hudson/plugins/albert/FossilSCM/config.jelly): > > <?xml version="1.0" encoding="UTF-8"?> > <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> > <f:entry title="Repository URL" field="remote_url"> > <f:textbox/> > </f:entry> > <f:entry title="Branch" field="branch"> > <f:textbox default="trunk"/> > </f:entry> > <f:entry title="Repository database" field="repository_file"> > <f:textbox/> > </f:entry> > </j:jelly> > > And have created the required FossilSCM class: > > public final class FossilSCM extends SCM > { > private final String remote_url; > private final String branch; > private final String repository_file; > private static final Logger logger; > > static { > logger = Logger.getLogger(FossilSCM.class.getName()); > } > > @DataBoundConstructor public FossilSCM( > final String remote_url, > final String branch, > final String repository_file) > { > this.remote_url = remote_url; > this.branch = branch; > this.repository_file = repository_file; > > FossilSCM.logger.log(Level.WARNING, "FossilSCM: " + this); > } > > public String getBranch() > { > return this.branch; > } > > public String getRemoteUrl() > { > return this.remote_url; > } > > public String getRepositoryFile() > { > return this.repository_file; > } > > /* ... */ > } > > And the (apparently) required DescriptorImpl as a static inner > class: > > @Extension public static final class DescriptorImpl extends > SCMDescriptor<FossilSCM> > { > private static final Logger log; > > static { > log = Logger.getLogger(DescriptorImpl.class.getName()); > } > public DescriptorImpl() > { > super(FossilSCM.class, null); > this.load(); > } > > /** > * Called by the Jelly config form to validate the Fossil > * repository URL field. > * > * Note that the name of this method is significant. > */ > > @SuppressWarnings({ "static-method", "unused" }) public > FormValidation > doCheckRemoteUrl( > @QueryParameter final String value) > { > DescriptorImpl.log.log(Level.WARNING, "doCheckRemoteUrl " + > value); > > try { > new URI(value); > } catch (final URISyntaxException e) { > return FormValidation.error("This is not a valid URI"); > } > > return FormValidation.ok(); > } > > @Override public String getDisplayName() > { > return "Fossil SCM"; > } > } > > Going by: > > https://wiki.jenkins-ci.org/display/JENKINS/Basic+guide+to+Jelly+usage+in+Jenkins#BasicguidetoJellyusageinJenkins-Formvalidation > > This should apparently be enough to validate the "remote_url" field. > However, upon entering a value into the field and saving the job... > Nothing happens. The doCheckRemoteUrl() method is never called and any > value is accepted. > > What am I doing wrong? > > Is there better documentation available? I seem to be working entirely > from out-of-date and/or incorrect examples. > > Regards, > M
