First, make sure you understand dependencies and their role in Ply by reading Dependencies.
Utilizing the electric-chilly
project made in Project Setup, let's add a dependency to the Google Guava project.
$ ply dep add com.google.guava:guava-collections:r03 -Pply.log.levels=info
The -Pply.log.levels=info
property override is unnecessary but added to give more detailed feedback about what transitive dependencies are being downloaded, see Changing Log Levels for details about available log levels. Your output should be similar to the following:
We can see that four dependencies were downloaded even though we only added one. Let's issue the ply dep tree
command to visualize the dependencies of electric-chilly
:
$ ply dep tree
It's now apparent that electric-chilly
has the one direct dependency which we added com.google.guava:guava-collections:r03
but that the guava-collections
dependency itself depends upon two other projects: com.google.guava:guava-primitives:r03
and com.google.guava:guava-annotations:r03
. The guava-primitives
itself depends upon com.google.guava:guava-base:r03
.
Let's now add junit
to our electric-chilly
project as a test dependency.
$ ply test:dep add junit:junit:4.10
Note, adding a test dependency is the same except the dep
script is run within scope test (i.e., test:dep
).
See Scopes for more information on their usage in ply.
Continue on to Repositories