- The post 'Running Your First Droplet on H2O' walked through cloning the h2o-droplets GitHub repository, which held simple starter projects in Java and Scala.
- The post described the java example's build.gradle file as depending on three H2O artifacts built in the h2o-dev repository: h2o-core, h2o-algos, and h2o-web.
- The post said h2o-core contained base platform capabilities like the distributed key or value store, h2o-algos contained math algorithms like GLM and Random Forest, and h2o-web contained the browser UI.
- The post walked through preparing the example project for IntelliJ IDEA using gradlew idea and then running its test inside the IDE.
A number of us were at Strata in New York City this October, and one of the major benefits of these events is getting lots of in-person time with people who use your product.
Michal and Amy spent some time with a developer who was trying to build on top of the h2o-dev repo, and we realized that we didn’t have a really basic example yet of using an h2o-dev artifact as a dependency in a brand new project.
So Michal put one together for everyone to share, and I’ll walk you through a quick introduction in this post.
1. Cloning the examples repository
The h2o-droplets repository on github contains some very simple starter projects for different languages. Let’s get started by cloning the h2o-droplets repository, and changing to that directory.
$ git clone https://github.com/0xdata/h2o-droplets.git
 
$ cd h2o-droplets
 
2. A quick look at the repo contents
As of this writing, the repo contains a java example and a scala example. Each of these is an independent starter project.
$ ls -al
 
Let’s take a closer look at the java example:
$ find h2o-java-droplet -type f
 
As you can see, the java example contains of a build.gradle file, a java source file, and a java test file.
Look at the build.gradle file and you will see the following sections, which link the java droplet sample project to a version of h2o-dev published in MavenCentral:
This is all very standard gradle stuff. In particular, note that this example depends on three different H2 O artifacts, all of which are built in the h2o-dev repository.
- h2o-core contains base platform capabilities like H2O’s in-memory distributed key/value store and mapreduce frameworks (the “water” package).
- h2o-algos contains math algorithms like GLM and Random Forest (the “hex” package).
- h2o-web contains the browser web UI (lots of javascript).
3. Preparing the example for use in your IDE
Let’s walk through an example using IntelliJ IDEA. The first step is to use gradle to build your IntelliJ project file.
$ cd h2o-java-droplet
$ ./gradlew idea
 
You will see three new files created with IDEA extensions. The .ipr file is the project file.
$ ls -al
 
4. Opening the project
Since we have already created the project file, start up IDEA and choose Open Project.
5. Running the test inside the project
Rebuild the project.
6. Summary
This small example demonstrated how to create a new project with H2 O as a dependency. Thanks to Michal for putting this example together! If you are working on a good example you’d like to share with the community, please send us a note or make a pull request to the h2o-droplets repository.
Tell us about this or other topics that interest you by writing to h2ostream@googlegroups.com .
:quality(75))