build.gradle file, task using << notation, intellij warns: “Cannot infer argument type”

后端 未结 5 2272
眼角桃花
眼角桃花 2021-02-19 00:42

I\'m new to groovy and gradle and was wondering whether someone knew why my scriplet wasn\'t working (edit actually it does work but the warning still appears). This section is

5条回答
  •  [愿得一人]
    2021-02-19 00:59

    Untill the IntelliJ bug is fixed, there is a workaround: use doFirst instead of <<.

    task hellofun() {
      doFirst {
        [silly:'billy'].each { k, v ->
          println "$k=$v"
        }
      }
    }
    

    Thanks for submitting the bug :)

提交回复
热议问题