1

I'm very new to Jenkins pipeline and trying to write some Groovy scripts in pipeline. Now, I'm using declarative pipeline and writing Groovy code in Jenkins UI itself which is not helping with auto-population of methods on objects, auto-import etc.

Generally when we use IDE like eclipse, Intellij Idea for Java programming, we can see respective imports are automatically added in the code and also autosuggestion is supported.

How can I groovy code effectively for Jenkins pipeline which would save my time and help with autom-suggestion of methods, imports, compilation error etc?

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • 2
    IHMO: Don't mix code and pipe. If using some code from pipe - then it should be your lib/function and so simple that you don't need autocomplete. – daggett Nov 21 '19 at 05:27
  • Check this out - https://jenkins.io/blog/2018/11/07/Validate-Jenkinsfile/ – Dibakar Aditya Nov 21 '19 at 07:14

1 Answers1

1

I have achieved auto-import, auto-completion (and somewhat unit-testing) in IntelliJ using this setup.

The caveat is that I'm using scripted pipeline and the setup is also used for Groovy scripts for Jenkins hooks and Jenkins shared library.

C D
  • 141
  • 6