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.