Getting started with jclouds

15 Aug


Update: Using jclouds 1.5.1

I’m just starting to get familiar with the open source jclouds cross-cloud toolkit. Whenever I get started with something new like this I like to start out with the most simple application possible that still does something sort of useful. And when starting out, I prefer to work from the command line so I can get a feel for how something is really put together. After that, when I move to using a build tool like Maven or Ant or putting everything into Eclipse or another IDE, I have a better understanding of its dependecies and config.

With that in mind I headed over to the jclouds installation page to download the JARs for it. Okay…what is lein???

Looks lein is part of leiningen. One of the tools that jclouds can use to manage dependencies. Downloading the lein script is no problem but I also need the project.clj file. No problem…but what version to put in the dependencies list?

After sifting through the jclouds group and jclouds-dev groups I find a post that points to beta.10 being the latest and greatest. I find a blog that points to 1.5.1 being the latest and greatest. I’ll try putting that in the project.clj file and give it a shot.

That’s a lot of JARs.

Now all I want to do is list all of my servers on the Rackspace open cloud. After some trial and error I came up with the following app.

Follow the instructions below to compile and run the app. Thankfully Java 1.6 allows for wildcard expansion on the command line, otherwise it would be a serious pain including all of those JARs.

There you have it. If anyone is more familiar with lein and/or leiningen and can show me how to limit it to downloading just the JARs I need, let me know in the comments.

This post was written on Mac OS X 10.8, Java 1.6.0, jclouds 1.5.1 1.5.0-beta.10. If you’re on a different OS and run into problems, please feel free to comment.


Posted by on August 15, 2012 in jclouds, openstack, rackspace


7 responses to “Getting started with jclouds

  1. jclouds (@jclouds)

    August 15, 2012 at 4:51 pm

    Hi, Everett!

    Nice post, and thanks!

    Here’s a couple things to help…

    to limit jars to just what you need, replace org.jclouds/jclouds-all with org.jclouds.provider/rackspace-cloudservers-us; also, to list nodes, you don’t need ssh, so you can take that dep out.

    also, and since you have lein anyway :)

    try this, to kick the tires on clojure!

    lein repl

    (use ‘org.jclouds.compute2)
    (def compute (compute-service “rackspace-cloudservers-us” “my-username” “my-api-key”))
    (pprint (nodes compute))

    Have fun!

    • Everett Toews

      August 15, 2012 at 7:19 pm

      Ah ha! I see now. project.clj is just Clojure source code. I haven’t had any exposure to Clojure so I didn’t even recognize what that file was. Well I know now…and I’ve run my first Clojure app.


  2. shivani kaushal (@shivanikaushal)

    May 14, 2013 at 6:52 am

    i tried doing exactly same steps, but jars are not downloaded. A folder with name “stale” got created in target directory instead. Do you have any idea what the problem could be?

  3. Chenna

    September 6, 2013 at 11:13 pm

    Hi Everett,

    Can you guide me on the installation of Openstack on Ubuntu 12.04.
    Configure it after installation.

    • Everett Toews

      September 7, 2013 at 10:30 am

      Installing OpenStack is very much outside the scope of this blog post ;)

      If you’re looking to just do some testing or get familiar with OpenStack, I suggest having a look at one of my posts on devstack. If you’re looking to do a full scale installation of OpenStack, go to where you’ll find installation guides for Ubuntu 12.04.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: