title: NoClassDefFoundError developing library with Android app, Maven, and Eclipse
body: <p>I'm developing an Android library (<a href="https://github.com/CUTR-at-USF/SiriRestClient/wiki" rel="nofollow noreferrer">SiriRestClient</a>) whose artifacts are managed via Maven, and I'm using Eclipse for development.  I'm packaging the artifacts as a JAR file, since I don't have any assets in the project, only Java classes, and there are <a href="https://github.com/rgladwell/m2e-android/issues/8" rel="nofollow noreferrer">issues packaging artifacts as apklibs with Eclipse/Maven/ADT</a>.</p>
  
  <p>I'm also developing an Android user interface application (<a href="https://github.com/CUTR-at-USF/SiriRestClientUI/wiki" rel="nofollow noreferrer">SiriRestClientUI</a>) that depends on the SiriRestClient library.  I'm managing the dependency on the SiriRestClient library via Maven.</p>
  
  <p>Both project build and deploy fine independently in Eclipse.</p>
  
  <p>THE PROBLEM:</p>
  
  <p>Since I started managing the SiriRestClientUI dependency on the SiriRestClient library via Maven, if I have the library project and SiriRestClientUI open simultaneously in Eclipse, I get a <code>NoClassDefFoundError</code> when I try to deploy the SiriRestClientUI app to a device.  </p>
  
  <p>For example:</p>
  
  <pre><code>11-01 16:11:52.288: E/AndroidRuntime(9409): java.lang.NoClassDefFoundError: edu.usf.cutr.siri.android.client.config.SiriJacksonConfig
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at edu.usf.cutr.siri.android.ui.MainActivity.onCreate(MainActivity.java:100)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.Activity.performCreate(Activity.java:4470)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.ActivityThread.access$600(ActivityThread.java:128)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.os.Handler.dispatchMessage(Handler.java:99)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.os.Looper.loop(Looper.java:137)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at android.app.ActivityThread.main(ActivityThread.java:4514)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at java.lang.reflect.Method.invokeNative(Native Method)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at java.lang.reflect.Method.invoke(Method.java:511)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
  11-01 16:11:52.288: E/AndroidRuntime(9409):     at dalvik.system.NativeStart.main(Native Method)`
  </code></pre>
  
  <p>This is a major annoyance during the simultaneous development process of the library and the app, as the only workaround I've found is to edit the library code, build the library project, close the library project, and then execute the SiriRestClientUI app.</p>
  
  <p>I think the issue stems from how Eclipse/Maven is handling the Maven dependencies when the library project is open.</p>
  
  <p>Here's an Eclipse screenshot showing the SiriRestClientUI project, when the library project (SiriRestClient, above it) is CLOSED:</p>
  
  <p><img src="https://i.stack.imgur.com/6eQhx.png" alt="enter image description here"></p>
  
  <p>You can see the <code>sirirestclient-1.0.0-SNAPSHOT.jar</code> file under "Maven Depedencies," being pulled from my local Maven repository, which is what I want.  Under this configuration, everything works fine.</p>
  
  <p>However, when I OPEN the SiriRestClient library project, my "Maven Depedencies" entries change and the JAR file disappears, and instead a folder for the project is shown:</p>
  
  <p><img src="https://i.stack.imgur.com/yIAll.png" alt="enter image description here"></p>
  
  <p>If I try to launch the SiriRestClientUI when both projects are open, then I get the <code>NoClassDefFoundError</code>.  So, it seems that Eclipse is redirecting the project build and the library classes aren't being included.</p>
  
  <p>THE QUESTION:</p>
  
  <p>How can I configure Eclipse/Maven so that it always relies on the JAR file in the local Maven repository, instead of switching the Maven dependency to the local project?</p>
  
  <p>Or, is there another way to get rid of the <code>NoClassDefFoundError</code> with this configuration?</p>
  
  <p>The pom.xml file for the library project is <a href="https://github.com/CUTR-at-USF/SiriRestClient/blob/master/pom.xml" rel="nofollow noreferrer">here</a>.</p>
  
  <p>The pom.xml file for the SiriRestClientUI app project is <a href="https://github.com/CUTR-at-USF/SiriRestClientUI/blob/master/pom.xml" rel="nofollow noreferrer">here</a>.</p>