How to resolve external dependencies for a plugin

Estimated reading time: 1 minute

Add dependencies to build.gradle

After your dependencies on Maven Central are already available, you can add them to build.gradle.

Let's refer to the following example: https://github.com/katalon-studio/katalon-studio-zip-keywords-plugin

plugins {

  id 'java'

  id 'groovy'

  id 'com.github.johnrengelman.shadow' version '4.0.4'

  id "com.katalon.gradle-plugin" version "0.0.6"

}

repositories {

  jcenter()

  mavenCentral()

}

sourceSets {

  main {

    groovy {

      srcDirs = ['Keywords', 'Libs', 'Test Listeners', 'Include/scripts/groovy']

    }

  }

}

dependencies {

  compile 'net.lingala.zip4j:zip4j:1.3.2'

}

shadowJar {

  exclude 'Temp*.class'

}

katalon {

  dependencyPrefix = "com.katalon"

  minimize = false

}

Besides, there is another benefit. Your dependencies will be repackaged in order to avoid conflicts with other plugins as much as possible.

User Contributed Notes