Developing an eclipse plugin using maven dependencies

I hit my head on the wall for about 6 months and did not find a brief understanding of the development mechanism of the eclipse plug-in with third-party resources.

We are trying to develop an ODA Eclipse to ride on top of an internal Spring code that accesses a set of information based on REST.

In broad strokes, this is what I feel we should be able to:

  • Enlarge our maven artifacts with Eclipse package info using tycho or the felix bundle plugin.
  • Configure the plugin project through Eclipse to implement ODA and the user interface.
  • Ask Tycho to create poms, etc. for the plugin.

Now that I'm getting dirty. I understand that there are two approaches

  • Manifest-First - which is the standard mechanism for determining plugin dependencies.
  • POM-First - which provides dependencies through Maven's resolution mechanisms.

I'm not quite sure where to start trying to start doing this, since I have never worked on developing an eclipse plugin.

One of the other questions I have is how does the developer of the eclipse plugin (maven aside) use already existing third-party code (i.e. Apache HttpClient 4.x)? Do I need to load banks, upload them to a directory inside the project, add them to the classpath, then go from there or is there a "repository" mechanism similar to that used with ivy, maven, gradle?

Thanks in advance, and I apologize if I am a little worried about this.

+4
source share
3 answers

The best way for the Eclipse plugin to use libraries is with OSGi packages. You simply install these packages on your target platform and reference them in the same way as eclipse.org plugins. Some of the library providers already offer their libraries as OSGi packages. If this is not the case, you can turn a simple library box into an OSGi bundle by simply adding a few manifest.

Depending on the build system you are using and whether the libraries are available as OSGi packages packaged in the p2 online repository, you can link to the URL and rely on your build to download and install the package.

+1
source

Disclaimer: your question is very wide, therefore it is impossible to answer it completely. However, I can give you some advice so you know what to look for.

In the Eclipse universe, the main source of libraries (in the sense of binary dependencies) are p2 repositories. However, since p2 repositories are rarely used outside the Eclipse context, you will not, for example. Find the p2 repository on the Apache HTTP Client project download page.

To address this issue, there is the Eclipse Orbit Project , which provides libraries used by Eclipse projects in p2 repositories.

If you cannot find a library or library version on Eclipse Orbit, you can also use libraries from Maven repositories. This, for example, is supported by Tycho through the pomDependencies = consider mechanism.

Please note that Eclipse plugins may depend only on libraries that are OSGi packages. Therefore, if the library in the Maven repository is not yet an OSGi package, you first need to convert it to an OSGi package, for example. with the maven-bundle plugin and the Embed-Dependency engine.

+2
source

If the question of choosing a build system for Eclipse plugins with dependencies still matters:

Today I released a new gradle plugin: Wuff version 0.0.1, which (I think) completely solves the problem. It allows you to create Eclipse packages and applications, as they will be โ€œnormalโ€ gradle projects. All OSGi woodoo are automatically generated (although configured). All dependencies are regular maven dependencies - regardless of whether the dependency is OSGi or a โ€œnormalโ€ library.

Sources and documents: https://github.com/akhikhl/wuff

+1
source

Source: https://habr.com/ru/post/1483382/


All Articles