JavaExec task and folder classpath scan


(Fedor Belov) #1

‘-cp’ param allows to sepcify folder to scan jars (http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath). 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’?


(Benjamin Muschko) #2

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 }