Installation
- Getting the binaries using lein
- Adding jclouds to your Apache Maven project
- Getting the binaries using Apache Ant
- Adding jclouds to your Apache Ant project
- Adding jclouds to your Clojure project using leiningen
- Making your own lib dir
- Using the jclouds Snapshot Builds
- Adding jclouds snapshot to your Apache Ant project
- Adding jclouds snapshots to your leiningen (clojure) project
Getting the binaries using lein
- Download lein and make it executable.
- Create a project.clj file with the below contents.
(defproject deps "1" :dependencies [[org.jclouds/jclouds-all "1.6.0"] [org.jclouds.driver/jclouds-sshj "1.6.0"]])
- Execute lein pom, then mvn dependency:copy-dependencies which will fill
target/dependencywith all the jclouds jars.
Replace the provider and api in the above directory paths to the ones you want to use in your project.
Adding jclouds to your Apache Maven project
If your project is managed using Apache Maven, then it is very easy to use the jclouds, just add the following your project's pom.xml:
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-all</artifactId>
<version>1.6.0</version>
</dependency>
</dependencies>
Getting the binaries using Apache Ant
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.
<project default="sync-lib" xmlns:artifact="urn:maven-artifact-ant" >
<target name="sync-lib" depends="initmvn">
<delete dir="lib" />
<mkdir dir="lib" />
<artifact:dependencies filesetId="jclouds.fileset" versionsId="dependency.versions">
<dependency groupId="org.jclouds" artifactId="jclouds-all" version="1.6.0" />
<dependency groupId="org.jclouds.driver" artifactId="jclouds-sshj" version="1.6.0" />
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="[1.0.9,)" />
</artifact:dependencies>
<copy todir="lib" verbose="true">
<fileset refid="jclouds.fileset"/>
<mapper type="flatten" />
</copy>
</target>
<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>
</project>
To only fetch the jars for a particular provider replace
<dependency groupId="org.jclouds" artifactId="jclouds-all" version="1.6.0" />
with
<dependency groupId="org.jclouds.provider" artifactId="the-provider-id" version="1.6.0" />
You can see the list of supported providers and their ids in the Supported Providers.
Adding jclouds to your Apache Ant project
If you use ant, you will need to install maven ant tasks. Then, add jclouds to your build.xml as shown below:
<artifact:dependencies pathId="jclouds.classpath">
<dependency groupId="org.jclouds"
artifactId="jclouds-allcompute"
version="1.6.0" />
<dependency groupId="org.jclouds"
artifactId="jclouds-allblobstore"
version="1.6.0" />
</artifact:dependencies>
Adding jclouds to your Clojure project using leiningen
If you use lieningen, you can add jclouds to your project.clj like below, supporting clojure 1.2 and 1.3:
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/core.incubator "0.1.0"]
[org.clojure/tools.logging "0.2.3"]
[org.jclouds/jclouds-allcompute "1.6.0"]
[org.jclouds/jclouds-allblobstore "1.6.0"]]
Making your own lib dir
- Using maven:
- Create a pom.xml file with dependencies you need (ex. org.jclouds/jclouds-all) and the snapshot repository, if you want snapshot version (1.6.1-SNAPSHOT).
- Execute
mvn dependency:copy-dependencies. - You'll notice a new directory target/dependency with all the jars you need.
- Using lein
- See "Getting the binaries using lein" above.
- Using ant
- See "Getting the binaries using Apache Ant" above.
Using the jclouds Snapshot Builds
If you want to use the bleeding edge release of jclouds, you'll need to setup a maven dependency pointing to our sonatype snapshot repo.
You need to update your repositories and add the following in your project's pom.xml:
<repositories>
<repository>
<id>jclouds-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-allcompute</artifactId>
<version>1.6.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-allblobstore</artifactId>
<version>1.6.1-SNAPSHOT</version>
</dependency>
</dependencies>
Adding jclouds snapshot to your Apache Ant project
If you use ant, you will need to install maven ant tasks.
Then, add jclouds snapshot dependencies to your build.xml as shown below:
<artifact:remoteRepository id="jclouds.snapshot.repository"
url="https://oss.sonatype.org/content/repositories/snapshots" />
<artifact:dependencies pathId="jclouds.classpath">
<dependency groupId="org.jclouds"
artifactId="jclouds-allcompute"
version="1.6.1-SNAPSHOT" />
<dependency groupId="org.jclouds"
artifactId="jclouds-allblobstore"
version="1.6.1-SNAPSHOT" />
<remoteRepository refid="jclouds.snapshot.repository" />
</artifact:dependencies>
Adding jclouds snapshots to your leiningen (clojure) project
If you use lieningen, you can add jclouds snapshots to your project.clj like below:
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/core.incubator "0.1.0"]
[org.clojure/tools.logging "0.2.3"]
[org.jclouds/jclouds-allcompute "1.6.1-SNAPSHOT"]
[org.jclouds/jclouds-allblobstore "1.6.1-SNAPSHOT"]]
:repositories { "jclouds-snapshot" "https://oss.sonatype.org/content/repositories/snapshots"}