Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing eclipse plugin using maven dependencies

I've been beating my head against a wall for about 6 months now and have not found a concise way of understanding the mechanism for developing an eclipse plugin with third-party resources.

We are attempting to develop an Eclipse ODA to ride on top of in-house Spring-based code that accesses a REST based info set.

In broad strokes - this is what I feel that we need to be able to do:

  • Augment our maven artifacts with Eclipse bundle information using tycho or a the felix bundle plugin.
  • Set up a plugin project through Eclipse for the ODA Implementation & UI.
  • Have Tycho generate the poms etc for the plugin.

Now here's where I get muddy. I understand that there are two approaches

  1. Manifest-First - which is the standard mechanism for defining a plugin's dependencies
  2. POM-First - which provides dependencies via Maven's resolution mechanisms.

I'm not entirely sure where to begin trying to start doing this as I've never worked on developing an eclipse plugin.

One of the other questions I have is, how does a developer of an eclipse plugin (maven aside) leverage already existing third-party code (i.e. Apache HttpClient 4.x)? Do they have to download the jars, dump them into a directory within the project, add to classpath, then go from there or is there a "repository" mechanism similar to what is used with ivy, maven, gradle?

Thanks in advance and I apologize if I was rambling a bit with that.

like image 239
Dave G Avatar asked May 29 '13 15:05

Dave G


People also ask

How do I add a Maven dependency in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.

What is difference between Maven dependency and plugin?

A plugin is an extension to Maven, something used to produce your artifact (maven-jar-plugin for an example, is used to, you guess it, make a jar out of your compiled classes and resources). A dependency is a library that is needed by the application you are building, at compile and/or test and/or runtime time.

How do Maven build plugins work?

In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.

What is Maven Eclipse plugin used for?

It provides the facility to create new maven projects that can be single-module or multi-module maven projects in eclipse IDE. This plugin helps us to import the existing maven projects in the IDE. Provision of managing, viewing, and changing the pom. xml file in the graphical format.


1 Answers

Disclaimer: Your question is very broad, so it is impossible to answer it completely. Still, I can give you some hints so that you know what to search for.

In the Eclipse universe, the primary source for libraries (in the sense of binary dependencies) are p2 repositories. However, since p2 repositories are rarely used outside of the Eclipse context, you won't e.g. find a p2 repository on the Apache HTTP Client project's download page.

To account for this problem, there is the Eclipse Orbit Project which provides libraries used by Eclipse projects in p2 repositories.

If you can't find the library or library version in the Eclipse Orbit, you may also be able to use the libraries from Maven repositories. This is for example supported by Tycho via the pomDependencies=consider mechanism.

Note however that Eclipse plug-ins can only depend on libraries which are OSGi bundles. So if the library in the Maven repository is not yet an OSGi bundle, you need to convert it to an OSGi bundle first, e.g. with the maven-bundle-plugin and the Embed-Dependency mechanism.

like image 138
oberlies Avatar answered Sep 19 '22 14:09

oberlies