Hi Gradle Team,
I am looking to create a CustomModel which can be used to list all the dependencies of a Gradle project.
using Groovy DSL we can achieve it with
Is there any way I can achieve the same thing using the Gradle Tooling API. Let me know if additional Gradle jars may be required for this.
Thanks a lot in advance.
Any help with this please?
Have you read through? http://gradle.org/feature-spotlight-gradle-tooling-api/
If so, which part in particular are you having problems with?
Thanks for your reply, Luke! I’ve been going through the Gradle API the past few days and I had some questions with regards to the GradleProject model in Tooling API.
I can see we can access the Project object in the GradleProjectBuilder. Can we add another method to retrieve dependencies via the Configurations Object in Project? .
This way my aforementioned problem can be solved, as I can use the GradleProject model to retrieve the project dependency jars.
We won’t be able to add that method I’m sorry.
Have a look at the IdeaProject model and/or Eclipse counterpart. You might be able to use those to get the dependency information you need. Otherwise, you’ll have to write a custom model to get the information.
I was able to use the IdeaProject and EclipseProjectModel to get the dependencies. But using them does not make for an IDE-agnostic solution :(.
If I write a custom model. I’ll have to apply that as a plugin to my target Gradle Project. Hence I can’t go down this route.
I recall seeing in another forum where releasing an IDE-agnostic model was on the roadMap for the gradle team.
Using those models doesn’t mean that someone has to use that IDE.
If I am not wrong, the Idea and Eclipse model relies on the presence of .iml and .classpath files through which they extract the dependencies of a gradle project.
I request you to consider this use case. What if we need to extract dependencies from a gradle project that was not imported using IntelliJ Idea/Eclipse or imported using Netbeans?
That’s not the case. The source of the data is the Gradle build itself.
You are right Luke. The .iml/.classpath has absolutely no bearing on this.
Thank you for your time. I am grateful for your help.
You’re welcome. Good luck with it.