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) .
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.
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 :
git clone firstname.lastname@example.org:anthonydahanne/g3-java-client.git
#to make sure everything (compilation, testing) is ok
mvn clean install
#to add the license header to the source files
#to commit the changes to github
git commit -a -m 'commit message'
git push origin master
#to release a new version (be careful there is no file named release.properties at the root of the project)
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
#to deploy the current version to a repository on my local file system :
mvn -DaltDeploymentRepository=snapshot-repo::default::file:../../m2repo/snapshots clean deploy
#to commit this repo to github (I created this Github repo to serve as a maven repo http://github.com/anthonydahanne/m2repo)
git commit -a -m 'new snapshot for g3-java-client'
git push origin master
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 !