Saturday, October 25, 2014

How To: List all compile dependencies using Gradle

Gradle makes it easy to add steps to the build process. Today I found a nice little task to list all project dependencies:


The only problem with this is when a project has some local dependencies that are included using compile files('lib/some.jar'). A dependency included in this way has no group, name, or version as it is not in a repository. This was causing a dependency in my project to show up as "null : unspecified : null". To get around this I made a variation of the task above which will list the filename of each jar file that is being included:


It comes in handy when you want your build server to provide a little more information for debugging problems. Simply add the task to your projects build.gradle file (anywhere below the dependencies block).

No comments: