How to make a task return some value and how to get it in java


(jomblick.21) #1

Let me explain my problem,

1.i have a java class from which i ll invoke a gradle task(using projectConnection) . That gradle task will generate a json object. Now i want that json object in my java class. How to get it? any ideas?

Thanks


(Peter Niederwieser) #2

Typically, tasks produce something more durable than an in-memory object. So you are using the tooling API? The best solution I’m aware of is writing the JSON to a file. Then you can also enable up-to-date checks for the task.


(jomblick.21) #3

yes… I’m using the gradle tooling… Without writing to file. is there anyway??

I’m trying to use ProjectBuilder in gradle to get the Project object.(My intention is like using project object directly acessing the data i need) but the project Object contains nothing :frowning: