JavaExec task and folder classpath scan

‘-cp’ param allows to sepcify folder to scan jars ( I’ve tried to use path with ‘/*’ but gradle throws an exception “Could not normalize path for file …”. How can I use this feature with ‘JavaExec’?

Have a look at the DSL documentation. Here’s also an example for setting the classpath:

def yourJarFiles = files { file(‘yourDir’).listFiles() }

task executeJava(type: JavaExec) {

main = ‘your.main.Main’

classpath = yourJarFiles }