title: How to handle Import-Package entries which come from jars on the Bundle-Classpath?
body: <p>I have put a few jars on my Bundle-Classpath. The line below shows the entry in my pom.xml, which uses the Felix plugin to create the manigest.mf for the bundle.</p>
  
  <pre><code>&lt;Bundle-ClassPath&gt;.,lib/com.springsource.org.h2-1.0.71.jar,lib/com.springsource.org.apache.lucene-2.3.2.jar,lib/com.springsource.org.apache.lucene.search-2.3.2.jar&lt;/Bundle-ClassPath&gt;
  </code></pre>
  
  <p>These jars have classes which import packages, but from what I can see, they all have a MANIFEST.MF, which has it's own (accurate) list of Import-Package statements.</p>
  
  <p>However, when I build my project (using Maven and the bundle plugin), it reports an error because it cannot resolve references to certain classes. Specifically the error is:</p>
  
  <pre><code>Unresolved references to [com.sun.tools.javac, javax.naming, javax.naming.spi, javax.servlet, javax.servlet.http, javax.sql, javax.transaction.xa]
  </code></pre>
  
  <p>All of these errors come from com.springsource.org.h2-1.0.71.jar and all these packages are imported in the manifest of that jar.</p>
  
  <p>I am unable to understand:</p>
  
  <ul>
  <li>Why is the Maven bundle plugin complaining, if these packages are already imported in the MANIFEST>MF of com.springsource.org.h2-1.0.71.jar</li>
  <li>Why are the problems coming only from com.springsource.org.h2-1.0.71.jar ? I tried removing that specific jar and the build goes through fine, even though com.springsource.org.apache.lucene.search-2.3.2.jar also has several entries for Import-Package in it's MANIFEST.MF ?</li>
  </ul>
  
  <p>About the second point, I did some investigation, and I feel like there is a pattern. All the imports which com.springsource.org.apache.lucene.search-2.3.2.jar specifies in it's manifest, are being satisfied by com.springsource.org.apache.lucene-2.3.2.jar, which is also specified on the Bundle-Classpath. </p>
  
  <p>The dependencies of com.springsource.org.h2-1.0.71.jar which are being satisfied by com.springsource.org.apache.lucene-2.3.2.jar (which is on the Bundle-Classpath), are not listed in the error message, however, those dependencies which are not satisfied by jars on the Bundle-Classpath are being listed in the error message.</p>
  
  <p>Not quite sure what is happening. What is the rule regarding jar files which are specified on the Bundle-Classpath ? Do their imports (even when they are specified in the Import-Package) element of their manifest, have to be listed in the main project's pom ? Or is this something which the Maven bundle plugin is enforcing ? If the latter is the case, is there a way to get away from the enforcing ?</p>