1

I've got an android project and an android library project (my own) it depends on. I'm using maven, including maven-android-plugin, for the automated build, and Eclipse as my IDE, with m2eclipse and m2e-android to bridge the two.

For the most part, it's working fine: I can do a maven build from the command line, and also build from Eclipse.

However, I semi-regularly get a build error in Eclipse for the main android app project that says "Project configuration is not up-to-date with pom.xml. Run Maven->Update Project or use Quick Fix.". When I do that, it seems to mess up the relative path from the app to the library project in the app's project.properties file. Specifically, the relative path to the library project changes from the correct one to one that reflects the relative position of the projects in the Eclipse workspace.

Example: the disk layout looks like this:

/libs
-- /my-lib
/apps
-- /my-app

Thus the correct relative path from my-app to my-lib is ../../libs/my-lib.

However, in my Eclipse workspace, my-app and my-lib are siblings, and when I do Maven-Update project, it updates project.properties such that the relative path to my-lib (i.e "android.library.reference.1=") becomes "../my-lib".

As a result, in Eclipse, I get compilation errors for all the references in the main app to symbols in the library project. If I then go to the Android properties dialog in Eclipse, in the bottom section where library projects are listed, my library project has a red X next to it. If I remove it and add it back, thus correcting the relative path in project.properties, then everything is fine again.

This is kind of a nuisance. Any idea how to address it? Note: although the changes to the relative path I described are correct, it is only a theory that this is related to the relative position of the projects in the Eclipse workspace -- that could be a coincidence.

j0k
  • 22,600
  • 28
  • 79
  • 90
Andy Dennie
  • 6,012
  • 2
  • 32
  • 51
  • When you update the project is it trying to grab a new version of the library to use? (sidenote - why are you doing maven->update project?) Sounds like a problem with m2eclipse... – matt5784 Jun 01 '12 at 17:15
  • Hmm, it might be trying to grab a new version, although the new version would be in the same location as the old version. I'm not sure how the reference from the main project to the library project is tracked, under the covers. Is it just a path, or is there a timestamp or checksum used? Regarding the sidenote question -- I do Maven->Update Project when I'm forced to do so due to a build error in Eclipse, although I haven't deduced yet exactly what triggers that error. The error says something to the effect of "project configuration out of date - run Maven->Update Project". – Andy Dennie Jun 01 '12 at 17:51
  • @RicardoGladwell yes. I'm wondering if perhaps this is related to [this question](http://stackoverflow.com/questions/7160006/m2e-and-having-maven-generated-source-folders-as-eclipse-source-folders) (Eclipse and Maven using different source directories), although, just like when I take my car to the mechanic, I can't seem to make the problem happen on demand right now (sigh). – Andy Dennie Jun 02 '12 at 00:44
  • update: I've determined that when I get into this state, the android.library.reference.1= line in my project.properties file is wrong, and removing/re-adding the reference to it in the Eclipse dialog fixes the path. In my case, the wrong path looked like ../mylibproject and the fixed path looks like ../../parentfolder/mylibproject. Apparently, I must be somehow causing the project.properties file to get rebuilt while in a different working directory sometimes. – Andy Dennie Jun 04 '12 at 15:56
  • updated question with additional details and a theory. – Andy Dennie Jun 06 '12 at 13:05

1 Answers1

1

This is a known issue and is being currently worked on:

https://github.com/rgladwell/m2e-android/issues/76

Ricardo Gladwell
  • 3,770
  • 4
  • 38
  • 59