How to add Pipeline DSL support to Intellij

Purpose

Add Pipeline DSL support to Intellij

Prerequisites

  • Intellij is installed
  • Existing Jenkins-Pipeline job

Install Groovy SDK

  1. Download desired groovy-sdk version from this site
  2. Extract archive to your preferred location

Add Groovy framework support

  1. Create new groovy project
  2. Right-click on project root and choose 'Add Framework Support'

  3. Check 'Groovy' and create a new library from downloaded sdk

  4. Click 'OK'

Add Pipeline DSL Support

  1. Create a temp Jenkins Pipeline job or use an existing one to browse the following link pattern: http://[JENKINSHOST]/job/[JOBNAME]/pipeline-syntax/gdsl.
  2. Copy the entire body text to a newly created file (pipeline.gdsl) under src folder in your groovy project.
  3. Create new Groovy script and start coding your JenkinsFile. Auto-completion should popup automatically.

Repeat steps 1-2 in case Jenkins' installed plugins, the ones that supports Pipeline DSL, get updated.