I blogged recently about building Android projects with Maven, and how we've set things up for team development using Maven, Android and Eclipse. This follow up post describes how someone joining the team would go about setting up and getting to work...

To join in the fun you need a straight-forward installation of the following pre-requisite tools:

  • Eclipse (I usually go for Eclipse classic)
  • Subversion
  • Maven 3.0.3
  • Android SDK

You will then need the following Eclipse plugins:

  • Android Development Tools (ADT) - update site: https://dl-ssl.google.com/android/eclipse/
  • m2eclipse - update site: http://download.eclipse.org/technology/m2e/releases
  • m2e-android - Whilst you can install this like a normal plugin (thx Ricardo for the correction), I recommend that you don't use an update site to install this - instead, follow the instructions at the bottom of this post (after the comic), or at the m2e-android site.

Since you are setting up to join an existing team, most of the maven configuration has presumably already been done for you. To get working on a project (assuming it is set up as I described) you need to check out two projects:

  1. The "parent" project containing the common configuration for all Android-Maven projects
  2. The project you actually need to work on
  3. (OK, yes, also any apklib library projects if you need to debug or work on those too)

I highly recommend checking out so that all of these projects are siblings in a common projects directory.

The biggest single difference from ADT's usual working style is that you can't (currently) work with the apklib projects as project dependencies because of this issue. Instead, if you make any changes to an apklib project, you'll need to mvn install or mvn deploy it before you can see the change in your dependent apk projects.

I found that I had to "mvn install" each of the apklib projects locally before the dependent projects would build, as the remotely deployed projects for some reason did not include the pom resource - I haven't yet had time to investigate why.

Converting Eclipse ADT projects to build with Maven, a lego comic strip made with Comic Strip It!

Installing M2E-Android

Don't install this like a normal Eclipse feature! To install M2E-Android, open an Android-Maven project and open the pom.xml. You should see that the element is being highlighted as an error, because without M2E-Android, M2Eclipse does not understand the apk or apklib packaging types.

In the header of the pom.xml editor you should see a red error message: plugin execution not covered by lifecycle configuration....

error when pom packaging set to apk or apklib

Click the error and some details open up, including two quick fixes. Click the first quick fix ("discover new m2e connectors"). The following dialog pops up and after a short search, shows the m2e-android connector:

discover connectors dialog

Install the connector and the warnings should go away. Actually on one of my two machines they did not - I don't know why, but I had to take the 2nd quick-fix option of turning it off in Eclipse. For me that's just about ok, as I want the maven build to be the master anyway.

blog comments powered by Disqus