Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i print out the JAVA classpath in gradle?

I am currently using gradle integration with ecplise. Is there a way to print out the classpath of a javaexec task?

like image 240
Ice Avatar asked Sep 02 '16 04:09

Ice


4 Answers

The simplest would be to set log level to info using --info

If you would like to not browse through the output you could add a line similar to this inside your JavaExec task

doFirst{
  sourceSets.main.runtimeClasspath.each { println it}
}
like image 82
judoole Avatar answered Oct 28 '22 05:10

judoole


sourceSets.main.compileClasspath.asPath

For printing, you can write below the line in your task:

println "Classpath = ${sourceSets.main.compileClasspath.asPath}";
like image 41
user3167916 Avatar answered Oct 28 '22 06:10

user3167916


With gradle v4 I was unable to get either of the above options to work, but using --debug and grep classpath did find the information.

like image 22
Jules Avatar answered Oct 28 '22 06:10

Jules


Or add println configurations.runtime.resolve() to your build.gradle.

like image 3
Holger Brandl Avatar answered Oct 28 '22 06:10

Holger Brandl