You must include the gradle libraries manually into your project, as I couldn’t get it from mvn repositories
class LaunchTest {
private LaunchTest(){}
static void main(String[] args) throws Exception {
// to execute Jar tasks like: gradle jar
String[] argss = ['--project-dir','/myWorkspace/myProject/myModule,'jar'] as String[]
org.gradle.launcher.GradleMain.main(argss)
}
}
Other way is to open a command line inside your Java application and execute gradle jar directly
Hope that helps