title: How to create Eclipse plugin with Spring support?
body: <p>I have a problem when creating even simple Eclipse plugin with Spring support. </p>
  
  <p>My main goal is to develop multi-module Eclipse plugin project using Apache Camel framework. That's why I'm trying to use Spring as IoC container(Camel has good Spring DSL) and Apache Maven as a build tool.</p>
  
  <p>Now I have very simplified sub-goal: create simple Maven project for Eclipse plugin (like HelloWorld), which can create Spring's ApplicationContext by bundle-context.xml file, get some simple dependency from there, and, for instance, print it to console.</p>
  
  <p>I started with spring-osgi-bundle-archetype archetype. I'm trying to use <a href="http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html" rel="nofollow">maven-bundle-plugin</a> but without success. Currently, I have following configuration in pom.xml:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
              &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.4&lt;/version&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;manifestLocation&gt;META-INF&lt;/manifestLocation&gt;
                  &lt;ignoreMissingArtifacts&gt;true&lt;/ignoreMissingArtifacts&gt;
                  &lt;instructions&gt;
                      &lt;Bundle-SymbolicName&gt;${bundle.symbolicName}; singleton:=true&lt;/Bundle-SymbolicName&gt;
                      &lt;Bundle-Version&gt;${pom.version}&lt;/Bundle-Version&gt;
                      &lt;!-- | assume public classes are in the top package, and private classes 
                          are under ".internal" --&gt;
  
                      &lt;Export-Package&gt;!${bundle.namespace}.internal.*,${bundle.namespace}.*;version="${pom.version}"&lt;/Export-Package&gt;
                      &lt;Private-Package&gt;${bundle.namespace}.internal.*&lt;/Private-Package&gt;
  
                      &lt;Import-Package&gt;.,*;resolution:=optional&lt;/Import-Package&gt;
                      &lt;Bundle-Activator&gt;${bundle.namespace}.Activator&lt;/Bundle-Activator&gt;
                      &lt;Bundle-ActivationPolicy&gt;lazy&lt;/Bundle-ActivationPolicy&gt;
                      &lt;Require-Bundle&gt;org.eclipse.ui,org.eclipse.core.runtime&lt;/Require-Bundle&gt;
                      &lt;Bundle-RequiredExecutionEnvironment&gt;JavaSE-1.6&lt;/Bundle-RequiredExecutionEnvironment&gt;
                      &lt;Embed-Dependency&gt;*;scope=compile|runtime;inline=false&lt;/Embed-Dependency&gt;
                      &lt;Embed-Directory&gt;target/dependency&lt;/Embed-Directory&gt;
                      &lt;Embed-StripGroup&gt;true&lt;/Embed-StripGroup&gt;
                      &lt;Embed-Transitive&gt;true&lt;/Embed-Transitive&gt;
                  &lt;/instructions&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>This configuration couse MANIFEST.MF generation with a lot of imported packages, all dependencies from pom.xml are embedded into target/dependency and declared in MANIFEST's Bundle-Classpath.</p>
  
  <p>But plugin still doesn't work: there are errors like </p>
  
  <p>NoClassDefFound: org.springframework.context.ApplicationContext </p>
  
  <p>or</p>
  
  <p>No available bundle exports package 'org.springframework.context' 
  (If I try to add this package to Import-Package forcingly).</p>
  
  <p>But archive with this dependency (spring-context-3.0.5-RELEASE.jar) exists in target/dependency and in Bundle-Classpath.</p>
  
  <p>I'm not very experienced in OSGi technology, so I even cannot understand whether this is a issue with Maven or with OSGi.</p>
  
  <p>Does anyone has experience on creation Eclipse plugins with Spring support? Any advice and comments are welcome. Also it would be great to see some OpenSource Eclipse plugin with Spring support.</p>