Jenkins Development with Gradle: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 7: Line 7:
<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
plugins {
plugins {
    id 'groovy'
  id 'groovy'
}
}


repositories {
repositories {
    maven {
  maven {
        url "http://repo.jenkins-ci.org/releases"
    url "http://repo.jenkins-ci.org/releases"
    }
  }
    mavenCentral()
  mavenCentral()
}
}


dependencies {
dependencies {
    implementation 'org.codehaus.groovy:groovy-all:3.0.7'
  implementation 'org.codehaus.groovy:groovy-all:3.0.7'
    implementation 'com.cloudbees:groovy-cps:1.31'
  implementation 'com.cloudbees:groovy-cps:1.31'
    implementation 'org.jenkins-ci.main:jenkins-core:2.121'
  implementation 'org.jenkins-ci.main:jenkins-core:2.121'
}
</syntaxhighlight>
==Jenkins Plugins as Dependencies==
The default packaging of Jenkins plugins is jpi, so JARs must be requested explicitly with "@jar" as follows:
<syntaxhighlight lang='groovy'>
dependencies {
implementation 'org.jenkins-ci.plugins:plain-credentials:1.4@jar'
}
}
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 04:27, 6 April 2021

Internal

Overview

build.gradle

plugins {
  id 'groovy'
}

repositories {
  maven {
    url "http://repo.jenkins-ci.org/releases"
  }
  mavenCentral()
}

dependencies {
  implementation 'org.codehaus.groovy:groovy-all:3.0.7'
  implementation 'com.cloudbees:groovy-cps:1.31'
  implementation 'org.jenkins-ci.main:jenkins-core:2.121'
}

Jenkins Plugins as Dependencies

The default packaging of Jenkins plugins is jpi, so JARs must be requested explicitly with "@jar" as follows:

dependencies {
 implementation 'org.jenkins-ci.plugins:plain-credentials:1.4@jar'
}