在Jenkins插件的配置果冻文件中填写ArrayList

Mtr*_*mpe 5 plugins list jelly jenkins

尝试实现插件的配置文件时出现问题。我使用现有的SideBar插件启动了程序,但是在将a List<String>作为变量添加到时遇到了问题class Actionprivate List<String> projects; 如何在果冻文件中填充这样的列表?

我尝试这样做:

<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>
Run Code Online (Sandbox Code Playgroud)

我在links.jelly文件中添加了这些行,但是它不起作用。

如果有人知道该怎么做,那就太好了。

谢谢

iwa*_*n.z 4

您的操作中的列表应该有一个类型(也是为了更好的阅读)

private List<YourObject> projects
Run Code Online (Sandbox Code Playgroud)

然后你的 config.jelly 看起来像这样:

<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>
Run Code Online (Sandbox Code Playgroud)