Working on a project we’re trying out rest.li and we’re using windows as our OS that makes the installation a little more cumbersome and I’d like to be able to redo the installation at a future point so in any case I needed to document the process and hi, why not do that so some one else than me could benefit from it. I’ll also install HTTPie since testing the generated services is a lot easier with that tool.
So let’s get rolling
The first subtask will be to install HTTPie and this post from Scott Hanselman help me but things seems to have changed slightly since then, so I’ll include a revised version
Firstly you’ll need to download Python I chose the 64-bit MSI installer when it’s installed then add the installation directory to your path. To do so follow this process
- Right click “Computer” in file explorer
- Choose “properties”
- Choose “Advance system settings”
- Press the “Environment variables” button
Depending on whether you installed for all users or just you you should then change the corresponding path variable (either you or system) and add the installation directory and “installation directory\Scripts” to the path
The former makes python available on the command prompt and the latter makes pip (a package management tool we’ll be using later) available.
To test that you’ve succeeded open a command prompt (windows-r and type cmd) first type python and hit enter there should be no error telling you that python is an unknown command, then repeat with pip
Next step is to install curl make sure that the executable is in a directory that’s also in your path variable and test in the same manner as with python and pip.
Next step is to execute distribute_setup.py you can do this using curl that you just installed
curl http://python-distribute.org/distribute_setup.py | python
- or if you have issues connecting using curl then download the file from the link above and simply double click it
Last step in installing HTTPie is to use pip
pip install -U https://github.com/jkbr/httpie/tarball/master
That will down load HTTPie and install it on your machine. Pip will place the httpie script in your python script folder so the tool is ready to be used from the command promt when it’s down downloading and you can test this by typing
at the command prompt and then hit enter.
We are going to need to install
- A JDK (1.6+ as of this writing)
First make sure that you have the JDK installed. You can find the installer on Oracles site. Gradle on the other hand can be found at the Gradle download page. With both the JDK and Gradle installed we’ll install Conscript which you can find on the github page. It’s a jar file and it should be sufficient to download and double click it
once you have conscript installed you should add that to your path as well and test it by executing the command
on the command line. With conscript installed it’s time to install giter8 to do so execute the following command
If you get an error saying jansi or some other lib could not be found. You might be blocked in a proxy due to the fact that your traffic can’t be inspected since sbt-launch will use a repository url starting with https. It might just work for you if you change it to http. You can do this (and will need to do it both for cs and g8) in the launchconfig file that can be found under your conscript installation folder in .conscript\n8han\conscript\cs for conscript and .conscript\n8han\giter8\g8 for giter8. If that does not work then you can try a slightly more complicated version which you can read about here
When g8 is installed and everything is working as it should. You can create your first project by simply executing
g8 linkedin/rest.li-skeleton in your command shell
We haven’t used gradle yet but you will have to when you wish to compile your rest.li project. The skeleton created in the previous step includes three gradle build files that will handle the code generation tasks for you. For how to actually work with rest.li and gradle see the rest.li site