groovy

    0熱度

    1回答

    我正在寫在斯波克測試,目前,這是基本結構: def "someTest"(String str, Class<? extends SomeClass> clazz) { setup: (current implementation) obj.get("Sample1") obj.get("Sample2") obj.get("Sample

    0熱度

    1回答

    我想從一個json的關鍵名是「label」並且想要存儲在一個列表中獲取所有的值。 我的問題是,標籤鍵的位置不固定。有時它在子節點下有時在父節點下,有時在子節點下到子節點。我們可以在常規中使用遞歸閉包,但我不知道如何? 的Json :: [ { { "id": "2", "label": "NameWhatever" }, {

    1熱度

    2回答

    嘗試將1天添加到簡單日期格式。發生在線路 import java.text.SimpleDateFormat Date date = new Date(); def dateformat = new SimpleDateFormat("YYYY-MM-dd") def currentDate = dateformat.format(date) log.info "Current Date

    0熱度

    1回答

    我們使用codenarc插件和gradle這個,我看在依賴怪事: codenarc - The CodeNarc libraries to be used for this project. \--- org.codenarc:CodeNarc:0.25.2 +--- junit:junit:4.8.1 -> 4.12 | \--- org.hamcrest:hamcrest-core:1.

    0熱度

    1回答

    我試圖攔截在Java環境中運行的Groovy腳本內的所有方法調用。 特別是我想檢查所有方法調用的返回類型,如果它是X我想用Y替換它。 我知道你可以在MetaClass上使用invokeMethod進行截取,但我只能對我編譯的腳本類做到這一點。如果腳本依次調用類A上的方法,那麼它將創建一個新的MetaClass[A],如果沒有手動從註冊表中手動獲取該MetaClass並使用元方法覆蓋MetaClas

    1熱度

    2回答

    我是groovy新手。我試圖在groovy中分割json對象中的值,但我似乎找不到解決方案。請在下面找到 def inputFile = new File("C:\\graph.json") def InputJSON = new JsonSlurper().parseFile(inputFile,'UTF-8') InputJSON.each{println i

    -1熱度

    1回答

    我有一個擴展名爲.idsl的groovy dsl文件,但在eclipse中無法在該文件中設置調試點。 我收到錯誤,如下面 切換行斷點」。 編制單位名稱必須以.java結尾的,或者註冊的類似Java的擴展之一

    1熱度

    1回答

    我怎麼能像類一樣調用def? 比如我調用類 class object{do things} new object() 我怎麼能與 def object {} 做請幫幫我。

    2熱度

    1回答

    我正在將Jenkins管道開發爲Groovy腳本(腳本管道,而不是聲明式),並且真正很困難。詹金斯始終是非常通用的關於語法/語義錯誤,輸出棧象下面這樣: groovy.lang.MissingPropertyException: No such property: caughtError for class: groovy.lang.Binding at groovy.lang.Binding.

    1熱度

    1回答

    我有下面的代碼片段在我Demo.groovy文件 class Person { String name } def name='no name' def p = new Person(name:'Igor') def cl = { name.toUpperCase() } cl.resolveStrategy = Closure.DELEGATE_ONLY cl.delega