Hi there,
I am trying to enhance a simple plugin for Jenkins that lets you run Scala
code in a pre/post build step.
The code is here - https://github.com/adamretter/scala_plugin
It is basically working, but I have a strange issue with fields in a
radioBlock, these fields accept values and I can see them persisted in the
job's config.xml, but when you go back to the Job Configuration webpage in
Jenkins those fields are now empty.
Basically my main plugin class looks like this -
public class ScalaBuilder extends Builder {
private String libDir;
private SourceBlock sourceBlock;
private String pathToScala;
private boolean debug;
private int port;
private boolean suspend;
@DataBoundConstructor
public ScalaBuilder(final String libDir, final SourceBlock sourceBlock,
final String pathToScala,
final boolean debug, final String port, final boolean suspend) {
The 2nd argument, which is "sourceBlock" relates to the radioBlock in the
jelly config. The source code of SourceBlock.java starts -
public class SourceBlock extends AbstractDescribableImpl<SourceBlock> {
private boolean urlSource;
private String srcUrl;
private String srcInline;
@DataBoundConstructor
public SourceBlock(final String value, final String srcUrl, final
String srcInline) {
And the relevant radioBlock part of the
src/main/resources/hudson/plugins/scalabuilder/ScalaBuilder/config.jelly
looks like -
<f:radioBlock name="sourceBlock" value="true" title="URL"
checked="${instance.getSourceBlock().isUrlSource()}">
<f:entry title="URL to .scala file" field="srcUrl">
<f:textbox />
</f:entry>
</f:radioBlock>
<f:radioBlock name="sourceBlock" value="false" title="Inline Script"
checked="${!instance.getSourceBlock().isUrlSource()}">
<f:entry title="Scala source code" field="srcInline">
<f:textarea />
</f:entry>
</f:radioBlock>
All of the code (there is not a great deal) is available at the GitHub link
at the top of this email. If someone could please help me understand why I
can save the form field values, i.e. they appear in the job's config.xml
(see below) but the ones from sourceBlock cannot be retrieved when I
re-open the Job Configuration page!
<hudson.plugins.scalabuilder.ScalaBuilder
plugin="[email protected]">
<debug>false</debug>
<libDir></libDir>
<sourceBlock>
<urlSource>false</urlSource>
<srcInline>println("hello world")</srcInline>
</sourceBlock>
<port>0</port>
<suspend>false</suspend>
<pathToScala>/usr/local/scala/bin/scala</pathToScala>
</hudson.plugins.scalabuilder.ScalaBuilder>
Thanks Adam.
--
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].
For more options, visit https://groups.google.com/groups/opt_out.