首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jelly.config中的可选块,在jenkins插件开发中没有转换到后端。

问jelly.config中的可选块,在jenkins插件开发中没有转换到后端。
EN

Stack Overflow用户
提问于 2015-03-04 16:19:13
回答 1查看 656关注 0票数 1

我有以下几个方面的jelly.config:

代码语言:javascript
复制
        <f:block>
            <f:optionalBlock inline="true" name="dynamic" title="Mandatory parameter for rpm artifacts only" checked="false"
                help="/plugin/artifactory/help/common/help-artifactType.html">
                        <f:entry title="Operating System">
                                <select class="setting-input" name="operatingSystem">
                                        <option value="rhel5">rhel5</option>
                                        <option value="linux">linux</option>
                                </select>
                        </f:entry>
                        <f:entry title="Architecture">
                                <select class="setting-input" name="architecture">
                                        <option value="64">64</option>
                                        <option value="32">32</option>
                                </select>
                        </f:entry>
            </f:optionalBlock>
        </f:block>

在我的serverDetails.js中有:

代码语言:javascript
复制
    public class ServerDetails {
    public final String operatingSystem;
        /**
         * This the type of operating system that your rpm builds on. If not specified, this passes null. 
         */
        public final String architecture;
        /**
         * This the type of architecture your rpm runs on. If not specified, this passes null. 
         */
    }

    public ServerDetails(String artifactoryName, String artifactoryUrl, String repositoryKey, String snapshotsRepositoryKey,
                             String downloadReleaseRepositoryKey, String downloadSnapshotRepositoryKey,
                             String downloadReleaseRepositoryDisplayName, String downloadSnapshotRepositoryDisplayName,
                             String userPluginKey, String userPluginParams,String artifactKey,String productKey, String operatingSystem, String architecture, String buildType) {
            this.operatingSystem = operatingSystem;
            this.architecture = architecture;
            this.buildType = buildType;
            createStagingPlugin();
        }

public ServerDetails(String artifactoryName, String artifactoryUrl, String repositoryKey, String snapshotsRepositoryKey,
                         String downloadReleaseRepositoryKey, String downloadSnapshotRepositoryKey,
                         String downloadReleaseRepositoryDisplayName, String downloadSnapshotRepositoryDisplayName) {
        this(artifactoryName, artifactoryUrl, repositoryKey, snapshotsRepositoryKey, downloadReleaseRepositoryKey,
                downloadSnapshotRepositoryKey, downloadReleaseRepositoryDisplayName, downloadSnapshotRepositoryDisplayName, null, null,null,null, null, null, null);
    }

在我的后端java中,我将它用作:

代码语言:javascript
复制
public String getOperatingSystem() {
        return details != null ? details.operatingSystem : null;
    }

    public String getArchitecture() {
        return details != null ? details.architecture : null;
    }

现在,当我访问操作系统和架构时,在前面选择它们之后,当我打印出来时,仍然会得到它们的空值。

我是不是漏掉了什么?为什么我得不到这些价值。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-04 19:35:01

在您创建的作业中,XML有哪些内容?您可以从URL localhost:8080/job//config.xml获得这一结果。

我猜你需要一个像here这样的here电话

未测试的

代码语言:javascript
复制
public ListBoxModel doFillOperatingSystemItems(
    @QueryParameter String operatingSystem
) {
    return new ListBoxModel(
        new Option("rhel", "rhel", operatingSystem.matches("rhel") ),
        new Option("linux", "linux", operatingSystem.matches("linux") ) 
    );
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28859457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档