Fill in a ArrayList within a configuration jelly file for a Jenkins Plugin

jelly, jenkins, list, plugins

Solution

The list in your action should have a type (also for better reading)

private List<YourObject> projects

Then your config.jelly can look like this:

<f:repeatable var="projectInList" name="projects" items="${instance.projects}" noAddButton="true" minimum="0">
    <fieldset>
        <f:entry title="${%Project}" description="Project desc." 
                                field="variableInProjectObject">
            <f:textbox value="${projectInList.variableInProjectObject}" default="" />
        </f:entry>
    </fieldset>
</f:repeatable>

Problem

I have a problem when trying to implement the configuration file of my plugin. I started my program with the already existing SideBar Plugin, but I encountered a problem when I added a `List<String>` as a variable to the `class Action` : `private List<String> projects;` How can I fill such a list within the jelly file? I tried doing as such : ``` <f:entry> <f:optionalBlock title="Project to be considered :"> <f:repeatable var="project" items="${link.projects}" name="projects" add="Add a project"> <f:entry title="Project 1 :"> </f:entry> </f:repeatable> </f:optionalBlock> </f:entry> ``` I added these lines in the links.jelly file, but it doesn't work. If anyone knows how to do this, it would be great. Thank you

Original source