2016-11-08 95 views
1

這是我正在努力實現的。 - 我的Jenkins工作中有兩個'選擇參數'。第一個選擇參數的值是硬編碼的。第二選擇列表應該基於第一選擇列表選擇來填充。我有一個屬性文件保存在詹金斯,它有鍵值對。第一選擇列表中的值和文件中的Keys是相同的。在第一個選擇列表中選擇一個值時,我想要一個代碼來讀取屬性文件,並使用與該鍵相對應的文件中的值填充第二個選擇參數。 對於第二選擇列表,我嘗試使用'Active Choice Reactive Parameter',引用參數= first_choice和以下的groovy腳本。但是這不會返回任何值。請幫忙!無法從詹金斯的屬性文件中讀取參數

def firstChoice = [first_choice] 
Properties props = new Properties() 
def stream = new FileInputStream('C:/Jenkins/books.properties') 
try{ 
    props.load(stream) 
    } 
    catch (Exception ex){ 
    println "Exception" 
    } 
    finally { 
     stream.close() 
    } 
def values = props.getProperty(firstChoice).split(",") 
return values 

回答