How do I compile the project via gradle/maven?

You can open a Katalon Studio project on your disk drive with Eclipse or Intellij-IDEA and compile groovy codes without Katalon. Have a look at the following discussion:

All I wanted to achieve through that discussion was running JUnit tests for my custom keywords. We did not discuss how to build a jar.

I would foresee it is possible but a tough task to utilize the Gradle groovy task for a Katalon Studio project. Why? — the first difficulty I see is, because the directory structure of a standard Katalon Studio project is completely different from the Gradle standard. There could be more of difficulties.