E
E
ENargit2011-03-25 14:18:58
Java
ENargit, 2011-03-25 14:18:58

How to create an Eclipse plugin using Spring?

Good afternoon!
There was a problem creating a plug-in for Eclipse. It needs to use Spring DI and a lot of modules and dependencies, so I decided to try and use Apache Maven to build it.
Initially took up the maven-bundle-plugin .
Configuration:

<pre>
&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;Export-Package&gt;${bundle.namespace}.*;version=&quot;${pom.version}&quot;&lt;/Export-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;
</pre>

So, the plugin generates everything in the form in which I would like to see it (all dependencies from pom.xml are built into the bundle along the target / dependency path), almost all packages are imported (declared in Import-Package in MANIFEST.MF).
However, the plugin does not work, it complains about the absence of the org.springframework.context.ApplicationContext class, although the archive with it lies in the target/dependency of the plugin and is included in the Bundle-Classpath. The package is not declared in Import-Package, when you try to explicitly declare it there, other errors appear, such as
No available bundle exports package 'org.springframework.context'<br/>
No available bundle exports package 'groovy.lang'<br/>
No available bundle exports package 'org.apache.wicket'<br/>
... Еще штук 30 ошибок, абсолютно не связанных с org.springframework.context и с проектом вообще (Groovy и Wicket вообще в workspace поиском не находятся, транзитивных зависимостей вроде тоже нет) ...<br/>

It is possible that the problem is from my lack of experience with OSGi. Any help is welcome.
This project is my upcoming thesis, I really want to make my own OpenSource project based on it. But for this you need to at least run it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ENargit, 2011-03-26
@ENargit

Decided on my own, as written here .
Unfortunately, this approach did not justify itself at all. It was possible to embed the modules into the Spring_a plugin, but the advantages of the modular architecture were lost (if the 2nd plugin needs Spring, it will again have to be archived).
In addition, the Apache Camel framework, for which everything was started, cannot work in an OSGI environment with a regular spring. Apparently, everything needs to be redone to use Spring DM / Eclipse Gemini Blueprint

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question