diff --git a/firstapp/samples/jclouds/pom.xml b/firstapp/samples/jclouds/pom.xml new file mode 100644 index 000000000..5b48b1942 --- /dev/null +++ b/firstapp/samples/jclouds/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + openstack.demo.app + faafo_infrastructure + 1.0-SNAPSHOT + + + 1.9.2 + + + + + + org.apache.jclouds + jclouds-all + ${jclouds.version} + + + + org.apache.jclouds.driver + jclouds-slf4j + ${jclouds.version} + + + ch.qos.logback + logback-classic + 1.0.13 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + + \ No newline at end of file diff --git a/firstapp/source/getting_started.rst b/firstapp/source/getting_started.rst index e3c704eeb..2e3a9787d 100644 --- a/firstapp/source/getting_started.rst +++ b/firstapp/source/getting_started.rst @@ -149,11 +149,55 @@ To interact with the cloud, you must also have .. only:: jclouds - `jClouds 1.8 or higher installed `_. + `jClouds 1.8 or higher installed `_. - .. warning:: + Our code samples use + `Java 8 `_. - This document has not yet been completed for the jclouds SDK. + We have created a Maven POM file to help you get started. + + If you do not know Maven then the `Maven home site `_ + is a good place to learn more. + + **pom.xml:** + + .. literalinclude:: ../samples/jclouds/pom.xml + :language: xml + + Place the above pom.xml into the root directory of your project. Then create the nested + subdirectory tree :code:`src` -> :code:`main` -> :code:`java`. + Place the Java code samples that you copy from this book into the folder named ":code:`java`". + + So, for example, the file named :code:`GettingStarted.java` from the end of this chapter + would be located as follows: + + .. figure:: images/jclouds/screenshot_maven_layout.png + :width: 328px + :align: center + :height: 179px + :alt: Screenshot of the Maven project directory structure + :figclass: align-center + + To use Maven to compile a downloaded sample, with the command prompt located in the same + directory as the :code:`pom.xml` file, enter: + + .. code-block:: bash + + mvn compile + + Maven will download and install any dependencies required for compilation, then execute + the Java compiler. All files in the :code:`java` subdirectory will be compiled. + + To use Maven to run each downloaded sample, with the command prompt located in the same + directory as the :code:`pom.xml` file, enter: + + .. code-block:: bash + + # In the sample below replace GettingStarted with the name of the class you want to run + mvn exec:java -Dexec.mainClass="GettingStarted" + + Maven will download and install any further dependencies required and then run the chosen + class. .. only:: libcloud @@ -1750,6 +1794,8 @@ information, the flavor ID, and image ID. .. only:: jclouds + **GettingStarted.java:** + .. literalinclude:: ../samples/jclouds/GettingStarted.java :language: java diff --git a/firstapp/source/images/jclouds/screenshot_maven_layout.png b/firstapp/source/images/jclouds/screenshot_maven_layout.png new file mode 100644 index 000000000..b1e691b3b Binary files /dev/null and b/firstapp/source/images/jclouds/screenshot_maven_layout.png differ