Gradles javaexec is failing miserably by not returning any error messages when it fails. All it will tell me is that the java binary returned a non-zero error code. That’s worthless for actually finding out what is wrong.
I want to work around this by executing the Java program using Java code in a task – i.e. Runtime.getRuntime.exec(“java -cp …”) instead of javaexec. In order to do this I will have to get the complete classpath from Gradle in the form of properly qualified or relative path names to all of the .jar files that have to be in the classpath.
I’ve tried this to get the classpath from Gradle
println sourceSets.main.runtimeClasspath
println sourceSets.main.compileClasspath
println sourceSets.test.runtimeClasspath
but all it prints is
file collection configuration ‘:compile’ file collection
How do I get Gradle to give me the classpath in the form that an Java program needs?
Thanks.