Getting MapR-DB Java API Samples Running Easier

Blog Post created by john.humphreys on Jun 7, 2017

This is just a quick note on how to get these samples: GitHub - mapr-demos/maprdb-ojai-101: Basic examples for OJAI & Mapr DB  running easily on a deployment server that may not have maven integration.


The samples are built to be run via maven  like this:

mvn exec:java -Dexec.mainClass="com.mapr.db.samples.basic.Ex01SimpleCRUD"

This works fine as maven has all of the dependencies available to it already.  If you have to run outside of maven, you need to carry all of the dependencies over.  If you just use the following Shade plugin configuration in your maven build plugins though:

                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">

Then you can easily run the jar just by doing "./jar-name.jar" on your MapR client server.


Also note that you should update the version of MapR-DB in the POM to be the same as whatever you actually have on your cluster.  We had 5.2 and this was for 5.1.