One can add new tasks to the Task list by declaring new tasks in the build.gradle file
Adding the following to build.gradle adds listJars task to the available tasks list.
task listJars << { configurations.compile.each { File file -> println file.path + File.separator+ file.name } }
Is there any way to achieve the same programmatically in a Java program ?