How can I use `def` in jenkins pipeline
问题 I am learning jenkins pipeline, and I tried to follow this pipeline code. But my jenkins always complain that def is not legal. I am wondering did I miss any plugins? I already installed groovy , job-dsl , but doesn't work. 回答1: As @Rob said, There are 2 types of pipelines: scripted and declarative . It is like imperative vs declarative . def is only allowed in scripted pipeline or wrapped in script {} . Scripted pipeline (Imperative) Start with node , and def or if is allowed, like below. It