It is very easy to install jclouds using Apache Maven. If you're new to Maven, read Maven in 5 Minutes.
If you do not have a pom.xml file, you can copy and paste the one below. If your project already has a pom.xml file, just add the dependency section below into it.
{% highlight xml %}
### Using the daily builds
If you want to use the bleeding edge release of jclouds, you‘ll need to setup a maven dependency pointing to our snapshot repository. You need to update your repositories and add the following in your project’s pom.xml:
{% highlight xml %} jclouds-snapshots https://repository.apache.org/content/repositories/snapshots true org.apache.jclouds jclouds-all {{ site.latest_snapshot }} {% endhighlight %}
mvn dependency:copy-dependencies
.You can add jclouds to your project.clj like below, supporting clojure 1.2 and 1.3:
{% highlight clojure %} :dependencies [[org.clojure/clojure “1.3.0”] [org.clojure/core.incubator “0.1.0”] [org.clojure/tools.logging “0.2.3”] [org.apache.jclouds/jclouds-all “{{ site.latest_version }}”]] {% endhighlight %}
You can add jclouds snapshots to your project.clj like below:
{% highlight clojure %} :dependencies [[org.clojure/clojure “1.3.0”] [org.clojure/core.incubator “0.1.0”] [org.clojure/tools.logging “0.2.3”] [org.apache.jclouds/jclouds-all “{{ site.latest_snapshot }}”]] :repositories { “jclouds-snapshot” “https://repository.apache.org/content/repositories/snapshots”} {% endhighlight %}
### Download the binaries
lein pom
, then mvn dependency:copy-dependencies
which will fill target/dependency with all the jclouds jars.Replace the provider and api in the above directory paths to the ones you want to use in your project. {% endcapture %} {{ m | markdownify }}
You will need to install maven ant tasks. Then, add jclouds to your build.xml as shown below:
{% highlight xml %} <artifact:dependencies pathId=“jclouds.classpath”> <dependency groupId=“org.apache.jclouds”artifactId=“jclouds-all” version=“{{ site.latest_version }}” /> </artifact:dependencies> {% endhighlight %}
You will need to install maven ant tasks. Then, add jclouds snapshot dependencies to your build.xml as shown below:
{% highlight xml %} <artifact:remoteRepository id=“jclouds.snapshot.repository” url=“https://repository.apache.org/content/repositories/snapshots” /> <artifact:dependencies pathId=“jclouds.classpath”> </artifact:dependencies> {% endhighlight %}
If you want to automate fetching the jclouds binaries, you can use the following Ant script.
Install ant, copy the following into a build.xml file, tweaking things like ‘provider’ and ‘driver’ as necessary. The following example uses jclouds-all, jclouds-sshj as a driver, and includes the logback jars for a logging implementation.
When you run this script with ant, it will build a lib directory full of jars you can later copy into your own project.
{% highlight xml %} <artifact:dependencies filesetId=“jclouds.fileset” versionsId=“dependency.versions”> </artifact:dependencies>
<get src="http://search.maven.org/remotecontent?filepath=org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" dest="maven-ant-tasks.jar"/> <target name="initmvn"> <path id="maven-ant-tasks.classpath" path="maven-ant-tasks.jar"/> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/> </target>
To only fetch the jars for a particular provider replace
{% highlight xml %} {% endhighlight %}
with
{% highlight xml %} {% endhighlight %} {% endcapture %} {{ m | markdownify }}
Last version can be downloaded from one of the Apache mirrors. {% endcapture %} {{ m | markdownify }}