It has been quite a while since my latest post but I worked on quite a lot of things beside my Android apps. However I’m working on OSGI Bundle at work and I’m not fan of Knopflerfish ant scripts because I find Maven way more complete and easier to use.
So I wrote a pom.xml to do the same work as the ant scripts. It might not be exactly what you want if you need to build 2 jars (one for impl and the other for api) but if you need the impl, check out this pom.xml.
Goal to build your jar bundle : clean install
If you’re not used to maven builds, please note that you should use provided scope on your dependencies for OSGI since you’re not including libraries inside your OSGI ( of course because they are loaded by the OSGI framework at runtime ). Moreover, the android-maven-plugin version used is for the SDK version 22. Check the generated jar MANIFEST.MF because the bundle plugin often add version requirement that you might have to check between the actual bundle version declared in the manifest and it’s maven dependency ! ( especially when you use built-in classes like OSGI framework classes ).
Standard directories are used (src/main/java for sources and target/classes for compiled classes). I won’t give a full tutorial on how to use Maven and the plugins behind my pom.xml because there are already quite a lot of docs on them but at least, it might save you some time 😉
If someone is interested, I might publish a fully working OSGI example 🙂