2

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 ?

tr_quest
  • 735
  • 2
  • 10
  • 24
  • What are you trying to do? – Opal Dec 08 '15 at 11:56
  • I am building a java program that executes tasks on other java gradle projects. So I need to execute the above task from my java program – tr_quest Dec 08 '15 at 12:00
  • Yes, I've some idea however no possibility to test it. I also suppose you try to reinvent the wheel :/ – Opal Dec 08 '15 at 20:18
  • My java program probes other java projects and collects dependency information. So the source program will need to run custom gradle tasks on target java projects – tr_quest Dec 08 '15 at 20:25

0 Answers0