You posted:
This error indicates that the :compileTestJava task does not know where your Groovy source files are located. Have you configured the SourceSets { ... } appropriately? Maybe not. You haven’t informed Gradle where in the Katalon project’s directory structure it should look into for the source; therefore it failed.
Let me elaborate this a bit. I made a sample Gradle project as follows (I used Gradle v8.0.2):
$ cd tmp
:~/tmp
$ cd sampleGradleProject
-bash: cd: sampleGradleProject: No such file or directory
:~/tmp
$ mkdir sampleGradleProject
:~/tmp
$ cd sampleGradleProject/
:~/tmp/sampleGradleProject
$ gradle init
Starting a Gradle Daemon (subsequent builds will be faster)
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 3
Select implementation language:
1: C++
2: Groovy
3: Java
4: Kotlin
5: Scala
6: Swift
Enter selection (default: Java) [1..6] 2
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2] 1
Generate build using new APIs and behavior (some features may change in the next
Project name (default: sampleGradleProject):
Source package (default: samplegradleproject):
> Task :init
Get more help with your project: https://docs.gradle.org/8.0.2/samples/sample_building_groovy_libraries.html
BUILD SUCCESSFUL in 33s
2 actionable tasks: 2 executed
:~/tmp/sampleGradleProject
$ tree .
.
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lib
│ ├── build.gradle
│ └── src
│ ├── main
│ │ ├── groovy
│ │ │ └── samplegradleproject
│ │ │ └── Library.groovy
│ │ └── resources
│ └── test
│ ├── groovy
│ │ └── samplegradleproject
│ │ └── LibraryTest.groovy
│ └── resources
└── settings.gradle
You can see the default directory structure that Gradle v8.0.2 assumes your project to have:
- your groovy sources should be placed in the
lib/src/main/groovy - your groovy test sources should be place in the
lib/src/test/groovy
All of Gradle tasks (including :compileGroovy, :compileTestGroovy) assumes your project looks as this.
On the other hand, a Katalon Studio project has a directory structure which is completely different from the Gradle’s default.
$ tree -L 3 .
.
├── Checkpoints
├── Data Files
├── Drivers
├── Include
│ ├── config
│ │ └── log.properties
│ ├── features
│ └── scripts
│ └── groovy
├── Keywords
├── Libs
│ ├── CustomKeywords.groovy
│ └── internal
│ └── GlobalVariable.groovy
├── Object Repository
├── Plugins
├── Profiles
│ └── default.glbl
├── Reports
│ └── Self-healing
│ └── broken-test-objects.json
├── Scripts
├── Test Cases
├── Test Listeners
├── Test Suites
├── bin
│ ├── groovy
│ ├── keyword
│ ├── lib
│ │ ├── CustomKeywords.class
│ │ └── internal
│ ├── listener
│ └── testcase
├── build.gradle
├── console.properties
├── settings
│ ├── external
│ │ ├── com.kms.katalon.composer.execution.settings.properties
│ │ └── com.kms.katalon.core.db.DatabaseSettings.properties
│ └── internal
│ ├── com.kms.katalon.composer.testcase.properties
│ ├── com.kms.katalon.execution.properties
│ ├── com.kms.katalon.execution.webui.properties
│ ├── com.kms.katalon.integration.analytics.properties
│ └── com.kms.katalon.integration.qtest.properties
└── skeletonProject.prj
If your project has a unique directory structure which is different from the Gradle’s default, you have to configure your Gradle project to be aware of the directory structure of your project. You have to write a lot of lines in the build.gradle and possibly in the settings.gradle. Theoreticaly it is possible as some articles describe it. See also the official document.