Maven and Android

If you find yourself with a Maven Android project which builds fine from mvn command line but gives errors in eclipse the problem may be this:

After a Maven / Update Project, your Eclipse build compliance is updated to what is found in the pom. Without need for “maven-compiler-plugin”, it uses the oldest level.

In my case, Eclipse wasn’t happy with @Override annotations. This was because it was updating to Java compliance to 1.5 which doesn’t support annotations. The problem was more confusing because it didn’t give the correct error. (It said that my methods were not overriding anything – removing them then gave the error that I needed to override two methods.)

The solution is to put


in your plugins section. This will then determine what the “Maven / Update Project” will use to set Eclipse compliance. You will notice both an apk and jar will be build when using the command line mvn.


Maven, Eclipse and Android

To use maven and eclipse with android projects:

You need the Maven Android Plugin ( for your maven builds.

And the m2e-android plugin ( for eclipse – otherwise you will get a pom error (“Plugin execution not covered by lifecycle configuration”).

Follow the usual steps to convert a project to maven after m2e-androud plug-in is installed (rt click on project / configure / convert to maven). One thing, when following instructions on the m2e-android plugin page for installing the plugin, you will get multiple hits when searching in the marketplace, the one you want is “Android Configurator for M2E”.

Eclipse puts apk in bin/, mvn puts apk in target/

Obviously this could all change and is only correct at time of writing.