Unirest
You can use a lightweight HTTP client library called Unirest for communicating with the JHU Course Search API in Java. Add the following to the dependencies
clause of build.gradle
:
compile 'com.konghq:unirest-java:3.11.09'
Then open the Gradle tool window and refresh the Gradle project (see the annotations in the image below).
Now Unirest is added to our project. You may be wondering how one finds out libraries like Unirest? Well, it's mostly through searching online. Once you found a library you want to use, you can usually find it in https://mvnrepository.com/.
In mvnrepository
, you can find the declaration you would need to add in a build script like build.gradle
as well as for other build systems (like Maven, Ant, Ivy, $\dots$)
Before we continue, let's commit the changes to our project. This time, instead of the terminal, got to the "Git" menu and select "Commit" (or press command
and K
on Mac) to open up the commit changes prompt.
Add a commit message and then press the commit button.
Notice only the build.gradle
file has changed in our Git repository. Although, all the files in the Unirest library are downloaded to the .gradle
folder, it is being ignored by Git.