Dependencies Management with Native Gradle Support (P.o.C)


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/dependencies-management-gradle-support.html
1 Like

How do I do this in Katalon version 7.9+ ?

Hello

This feature is currently available as a P.o.C only and you can download it with the link provided in the document. Please be noted it’s not ready for production use.

Jass

I see. I have to download Katalon Studio v8.0.0.rc.
Thanks!

So, since we are now on version 8.2.0, and there is a build.gradle file in Katalon, how do I get the gradle plugin installed so that I can leverage the dependency management of the build.gradle file?

I would show you how I use the dependency management of the build.gradle file in a Katalon Studio project.

  1. I installed Gradle into my Mac. There are many ways to do that. I installed Gradle using Sdkman as https://riptutorial.com/gradle/example/4351/installing-with-sdkman

  2. I wrote a build.gradle file with a custom task named “drivers”, which downloads jars from the Maven Central repository, and copy the jars into the Drivers folder of my Katalon Studio project. For example, see the following code: https://github.com/kazurayam/TestClosure/blob/develop/build.gradle

task drivers {
    doFirst {
        delete fileTree("Drivers") {
            include("**/" + AUTO_IMPORTED_JAR_PREFIX + "*")
        }
    }
    doLast {
        copy { copySpec ->
            copySpec
                .from(project.getConfigurations().getByName("myconf"))
                .into("Drivers")
                .include(
                    "**/ashot*.jar",
                    "**/ashotwrapper*.jar",
                    "**/junit4ks*.jar",
                    "**/timekeeper*.jar",
                    "**/webdriverfactory*.jar"
                    )
                .rename({ s ->
                    AUTO_IMPORTED_JAR_PREFIX + s
                    })
        }
    }
}
  1. I execute the task in the command line as:
$ cd $projectDir
$ gradle drivers
  1. I get the external jars copied into the Drivers dir:
$ ls Drivers
AUTOIMPORTED_ashot-1.5.4.jar
AUTOIMPORTED_ashotwrapper-0.1.0.jar
AUTOIMPORTED_junit4ks-1.6.1.jar
AUTOIMPORTED_timekeeper-0.3.3.jar
AUTOIMPORTED_webdriverfactory-0.2.2-SNAPSHOT.jar
  1. I will stop Katalon Studio and restart it so that it recognises the jars.

I use Gradle in the command line. I am a man who lives comfortably in the command line world. I use Gradle wherever I develop Java/Groovy projects in Emacs and IntelliJ IDEA, not only in Katalon Studio. I already know Gradle well. So I am not interested in Katalon GUI support for Gradle.

But a users who do not know Gradle at all may require GUI support by Katalon Studio; though I do not thinks there would not be many.

What I would really dream about Katalon Studio is that Katalon Studio re-design its mechanism of dependency management entirely to be on the Maven style. The distributables (.zip, .dmg) of Katalon Studio simply bundles a lot of external dependencies (jars) but it does not offer users to utilize the Maven/Gradle’s dependency management for the top-level jars which are pre-installed in the distributables.

A problem arose at

Katalon Studio v8.2.1-alpha bundled Selenium 4, but Katalon team did not bundled (intentionally, or just forgot it, i don’t know) some jars required by Selenium 4. I had a hard time to resolve the dependency for org.seleniumhq.selenium:selenium-devtools-v96:4.1.1.

If Katalon Studio is entirely based on the Maven/Gradle-like dependency management, then the dependency for org.seleniumhq.selenium:selenium-devtools-v96:4.1.1 should be automatically resolved. However, in fact, it does not work like this.

Dependency management is a deep technical issue. It is not really a matter of GUI design.

Thanks for this! It’s kind of annoying that the gradle plugin for eclipse (buildship) is not installed in Katalon studio, but the build.gradle file has been created. The plugin makes it trivial to be able to pull in new dependencies, simply by adding an entry to the dependencies section of the build.gradle file and then right clicking on the file and clicking the “gradle”->“refresh gradle project” option. I’m not afraid of the command line and doing it outside of Katalon Studio, but it would be so much easier for those on my team who aren’t as comfortable to have this integration.