[
https://issues.apache.org/jira/browse/HBASE-14876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035779#comment-15035779
]
Daniel Vimont commented on HBASE-14876:
---------------------------------------
I’ve attached a prototype of an archetype which you can download and install
locally, so that you can create a test project from it and see if this is what
you had in mind. (Ultimately, the real HBase archetypes will be housed in the
Central Maven repository. The steps below are only used to install an archetype
into your local Maven repository for testing purposes.)
This archetype is based upon the standard Maven “quickstart” archetype
(“maven-archetype-quickstart”). I started with a project generated from that,
made a few changes to the project’s POM (chiefly, adding a single dependency
upon “hbase-client” -- version 1.1.2) and added sample client code
(“HelloHBase.java”).
INSTRUCTIONS
(1) Download and unzip “archetype_prototype.zip”.
(2) Go into the “archetype_prototype” directory, and execute: {{mvn install}}
This will install the archetype (which is called
“simple-hbase-client-archetype”) 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 (e.g.,
“NetBeansProjects”), and execute the following: {{mvn archetype:generate
-DarchetypeCatalog=local}}
This will interactively ask you to (a) choose from a numbered list which
archetype you want to use (in this case, choose the number corresponding to
“simple-hbase-client-archetype”), (b) specify groupId (e.g., “org.example”),
(c) specify artifactId (e.g., “test-hbase-client-project”), (d) specify version
(default is “1.0-SNAPSHOT”), (e) specify package (e.g.,
“org.example.testpackage”).
Your new project artifacts will be found in a new directory with the same name
as the artifactId value that you specified above. Drilling down in the src
directory, you’ll find a single file, “HelloHBase.java”, which serves as kind
of a quicky tutorial for complete newbies, or which can simply be deleted by
those who are ready to write their own client code.
A few points to consider…
*VERSIONING*: Each archetype needs to be versioned. In the case of the
prototype that I produced, I went with the following versioning scheme: since
this archetype has only one direct dependency (hbase-client), I assigned to the
archetype the same version as the version of hbase-client that is used (i.e.
1.1.2). With this versioning scheme, the presumption is that whenever a new
version of hbase-client is deployed to the central Maven repository, a new
version of this archetype will need to be deployed as well (with both items
having the same version number).
*LIFE-CYCLE*: After working with archetypes for a few days and experimenting
with the various functions that are available, I could foresee the following
steps being followed to come out with a new “version” of an archetype.
(1) Use “mvn archetype:generate” to generate a new project from the current
version of the archetype.
(2) Make desired modifications (to the Java code, to the POM dependencies,
whatever) to the project generated in step 1.
(3) Generate a new version of the archetype by executing “mvn
archetype:create-from-project“ against the revised project from step 2.
These three steps just give a broad overview; details on these steps (and other
required steps) will need to be fleshed out. In fact, I should be able to come
up with pretty detailed documentation on all of this, since I've been taking
rather detailed notes as I've been stumbling along...
> Provide maven archetypes
> ------------------------
>
> Key: HBASE-14876
> URL: https://issues.apache.org/jira/browse/HBASE-14876
> Project: HBase
> Issue Type: New Feature
> Components: build, Usability
> Reporter: Nick Dimiduk
> Assignee: Daniel Vimont
> Labels: beginner
> Attachments: archetype_prototype.zip
>
>
> To help onboard new users, we should provide maven archetypes for hbase
> client applications. Off the top of my head, we should have templates for
> - hbase client application with all dependencies
> - hbase client application using client-shaded jar
> - mapreduce application with hbase as input and output (ie, copy table)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)