Jenkins Groovy Script Code Completion

jenkins groovy script code completion

Do you always remember all methods of all classes in Jenkins and its plugins ? I don’t and it was had for me to google everything.

In my example I am using IntelliJ. Create a new MVN project jenkinsgroovy and add at least jenkins-core and the plugins you need as dependency in the pom.xml.

Example of pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>jenkinsgroovy</groupId>
    <artifactId>jenkinsgroovy</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>jenkins-releases</id>
            <url>http://repo.jenkins-ci.org/releases/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.jenkins-ci.main</groupId>
            <artifactId>jenkins-core</artifactId>
            <version>1.626</version>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.main</groupId>
            <artifactId>maven-plugin</artifactId>
            <version>2.9</version>
        </dependency>
    </dependencies>

</project>

To add a groovy sdk to the project, go to: File -> Project Structure -> SDKs