Is there a way to "dump" all the information about a variable?

(Chris Warren) #1

My apologies if this is off-topic.

I used to write a lot of Perl, and Data::Dumper was terrifically useful to me. As I’m learning Gradle and Groovy, I frequently find myself wishing I could get more data about objects I’m trying to work with, without knowing the properties of the object beforehand. “How do I find out everything about project.artifacts, and then how do I learn about what each artifact’s properties and methods are?”, for example. I suspect the DSL reference has a lot of the information I need, but I haven’t been able to internalize it yet, and I don’t always understand exactly what it means when it says things like “The ArtifactHandler is passed to the closure as the closure’s delegate.”

Thanks for any help or suggestions you can offer.

(Peter Niederwieser) #2

There isn’t currently anything built-in for that. You could try to use Java or Groovy reflection to print out methods and properties of an object, but I can’t say how close it would come to the actual API exposed by the object. The DSL reference is probably the better option for now. There are plans to make Gradle builds more discoverable in the future.