Archives de catégorie : java

Hosting a new maven project on Github, g3-java-client, a Gallery3 remote client library

I finally started a java library to implement Gallery3 REST remote API; g3-java-client (the name is not really original huh ?!)

Here are the steps I followed to create this project.

The technical choices

Creating this project, I wanted a lightweight Java library, easily embeddable in an Android application  (G2Android not to name it, a Gallery2 client for Android).

So I carefully designed my dependencies, in order to leverage Android already included libraries, such as Apache Http Client, org.json packages (by the way I initially wanted to use the jersey REST client API, but… I wanted to stay as close as possible to the Android platform…)

Finally, I’m developing this library using TDD, and Maven as a CI tool :  I want a really reliable library, for 2 reasons : because it is motivating to create quality code, and also it is really painful to test an android application (you have to start an emulator or AVD and deploy the binary each time you launch a test, and each of these steps can take time) .

The licensing

I chose GPL v3 to make sure my work remains open source and not used in any commercial projects.

I’m using maven-license-plugin to add the license to the source files.

The hosting

I chose Github, mainly because I wanted to get familiar with git : I have heard so many people happy using Git instead of SVN,  and I also wanted to be able to switch easily from trunk to another branch… sounded appealing to me !

To tag the sources, I decided to follow Ulrich’s steps using mvn-release-plugin to tag every new release (in French, but you can follow this link to have an equivalent article in English)

And to host the binaries, I created a maven repo out of  a new Github project following Chas’tutorial; sure I could have asked to host my project on Sonatype’s Nexus for Open Source Software, but as the project is actually really young, I prefer to use my own repo; I guess later on I’ll switch to this better solution.

The commands used

If I had to initialize the workspace from another computer, I would type the following commands :

We just added the license info, committed the snapshot version , committed the stable version and also created a new branch (mvn release:prepare)

Now, we can deploy it to a maven repo

Pretty clear and easy right ? (except the deploy phase…) all of this thanks to Maven and my pom configuration.

What’s next ?

First, finish implementing all the Gallery3 REST remote API commands; and then, create a new android project (G3Android ?!) to consume this library; using … maven-android-plugin of course !