Attaching a zip file, archetype_mr_prototype.zip, containing the components of a Maven archetype suitable for testing in a sandbox environment. It is provided separately here so that folks can try it out and comment on it before we try to incorporate it into the HBase project and push the archetype into the Maven central repository.
The MapReduce job code that is generated from this archetype is called CopyTableExample.java, and it is derived from CopyTable in the HBase project. Also included is a corresponding test class TestCopyTableExample.java.
This archetype generates a prefab project for the user which (a) automatically establishes for them all required Maven dependencies, (b) provides a complete example of HBase-oriented MapReduce job code, and (c) provides a complete example of test code showing how to use the HBaseTestUtility to easily and effectively test a MapReduce job.
It's recommended to do the following in a separate sandbox environment, not in an active development environment. (I use VirtualBox to set up a fresh Ubuntu environment whenever I need a new sandbox.)
(1) Download and unzip archetype_mr_prototype.zip.
(2) Go into the archetype_mr_prototype directory, and execute: mvn install
This will install the archetype (which is called hbase-mapreduce-job-archetype, version 1.1.2-alpha) into your local Maven repository.
(3) To create a new project based upon the archetype, go to the directory in which you want the project folder and its contents to be created, and execute the following:
mvn archetype:generate -DarchetypeCatalog=local
This will interactively ask you to (a) choose the number of the archetype you want to use from a numbered list that is displayed (in this case, choose the number corresponding to “hbase-mapreduce-job-archetype”), (b) specify groupId (e.g., “org.example”), (c) specify artifactId (e.g., “test-hbase-mapreduce-project”), (d) specify version (default is “1.0-SNAPSHOT”), and (e) specify package (e.g., “org.example.testpackage”).
Your generated project components will be found in a new directory named with the artifactId value that you specified above. Going to the new project directory and running mvn install from the command line should result in downloading of all dependencies, compiling of the provided Java classes, and running (hopefully to success) of all the tests in the test class. Note that the tests could take 3 to 5 minutes to complete.