Installation and Setup of UniRest Java

Installing

Is easy as pie. Kidding. It’s about as easy as doing these little steps:

With Maven

You can use Maven by including the library:

<dependency>    <groupId>com.mashape.unirest</groupId>    <artifactId>unirest-java</artifactId>    <version>1.4.9</version></dependency>

There are dependencies for Unirest-Java, these should be already installed, and they are as follows:

<dependency>  <groupId>org.apache.httpcomponents</groupId>  <artifactId>httpclient</artifactId>  <version>4.3.6</version></dependency><dependency>  <groupId>org.apache.httpcomponents</groupId>  <artifactId>httpasyncclient</artifactId>  <version>4.0.2</version></dependency><dependency>  <groupId>org.apache.httpcomponents</groupId>  <artifactId>httpmime</artifactId>  <version>4.3.6</version></dependency><dependency>  <groupId>org.json</groupId>  <artifactId>json</artifactId>  <version>20140107</version></dependency>

If you would like to run tests, also add the following dependency along with the others:

<dependency>  <groupId>junit</groupId>  <artifactId>junit</artifactId>  <version>4.11</version>  <scope>test</scope></dependency><dependency>  <groupId>commons-io</groupId>  <artifactId>commons-io</artifactId>  <version>2.4</version>  <scope>test</scope></dependency>

Without Maven

Alternatively if you don’t use Maven, you can directly include the JAR file in the classpath: http://oss.sonatype.org/content/repositories/releases/com/mashape/unirest/unirest-java/1.4.9/unirest-java-1.4.9.jar

Don’t forget to also install the dependencies (org.jsonhttpclient 4.3.6httpmime 4.3.6httpasyncclient 4.0.2) in the classpath too.

There is also a way to generate a Unirest-Java JAR file that already includes the required dependencies, but you will need Maven to generate it. Follow the instructions at http://blog.mashape.com/post/69117323931/installing-unirest-java-with-the-maven-assembly-plugin