Add a dependency via command line ala pip and npm?

After reading through the docs and doing some searches I haven’t found a way to add a dependency using the command line. Is this currently possible or does anybody know of a plugin that provides this functionality.

Coming from Python and JavaScript development I miss being able to quickly add a library using the command line (pip install or npm install). If nothing exists out there perhaps I could attempt to add this functionality. If so should it be a plugin or part of the existing CLI functionality?

You could certainly do that in a plugin.

Personally I don’t see the benefit yet. Calling something like gradle addDep --gav junit:junit:4.12 --configuration compile seems more work to me than just opening my build file.

what about just gradle add junit? It would install the latest release version as a compile dependency by default. Wow! Sensible defaults!
If you want to get more granular: gradle add -v 4.12 -c testCompile junit or gradle add -c testCompile org.junit:junit:4.12

Did you create it ? :smile:

This would allow you to add dependencies programmatically easily. I, for example, would like to add dependencies to an existing gradle project as part of a script.