Building an Eclipse plugin using Maven
Asked Answered
S

3

10

I am trying to configure Maven to build an Eclipse application (Eclipse plugin packaged with all of the Eclipse EXEs etc).

I have already Mavenised dozens of dependencies of the project and deployed them to our internal Nexus (OSS) server. I have also installed the Nexus P2 Repository Plugin and the P2 Bridge Plugin (2.6.3-01) and the Nexus Unzip Plugin (0.12.0). I can browse to the .meta/p2 folder of our group repository, but it is currently empty.

This should be a lot simpler than it currently appears to be. I'm targeting Eclipse 3.4.2 (Ganymede) on Windows. If it makes any difference, we actually deploy our application packaged as a stripped-down/customised Eclipse installation.

eclipse-repository

When I run maven against a pom with <packaging>eclipse-repository</packaging> I get the following error:

[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'org.eclipse.equinox.executable.feature.group 0.0.0' 
          but it could not be found

...where do I get that from, and how do I add it to Nexus?

When I run maven against a pom with <packaging>eclipse-plugin</packaging> I get the following error:

[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'bundle org.eclipse.ui 0.0.0'
          but it could not be found

...but I found the following directories on my local file system (suspect itp-04-rcp generated the first one):

D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.6.2.M20110203-1100
D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.7.0.v20110928-1505

Tycho POM-First artifacts

I've also tried the pom-first-dependencies and manifest-first-dependency combo: http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts

I don't understand how this works - I can build itp02 from Git. I can see that it builds two bundles:

+---------------------+---------------------+--------------------------------------+
| artifactId          | Bundle-Name         | Bundle-SymbolicName                  |
+---------------------+---------------------+--------------------------------------+
| pomfirst-bundle     | pomfirst-bundle     | tycho.demo.itp02.pomfirst-bundle     |
| pomfirst-thirdparty | pomfirst-thirdparty | tycho.demo.itp02.pomfirst-thirdparty |
+---------------------+---------------------+--------------------------------------+

...but how does build02 pick these up? The only bit that seems relevant is:

Import-Package: tycho.demo.itp02.pomfirst

...that doesn't have anything to do with either of the Bundle-Names.

Felix Maven Bundle Plugin

I tried the Felix maven-bundle-plugin. I include all of my regular maven dependencies in a pom with <packaging>bundle</packaging>.

  • mvn deploy creates something at /nexus/content/repositories/snapshots/.meta/p2/plugins. I can download the jar via a browser, but all of the dependency jars are named "artifact-vresion" rather than "artifact_version" - is that right?

  • mvn bundle:bundleall creates an OSGI bundle for each of the transitive dependencies, but I'm not sure what to do with them from here.

  • mvn bundle:deploy refuses to do anything unless I specify -DremoteOBR and probably a few other parameters which I don't really understand.

Steenbok answered 27/11, 2013 at 6:12 Comment(3)
What is your specific question? It seems that you want to get a solution to the whole "how do I develop a plugin" story. Such a question is not suitable for stackoverflow because it would require answers in the length of a blog post.Garvey
@Garvey - I just want a solution that will work - How do I use maven artifacts in our Nexus repo to build an RCP application?Steenbok
The trouble is that the documentation for this is spread out over dozens of pages/blogs/wikis, there are various approaches and so many aspects to it and I don't know how to verify that each part is working. ...the RCP app is going to need artifacts from the Nexus repositories "Internal", "Snapshots", and other proxied repos - do I configure the P2 Capabilities to point at the "Public" group repo? What about the "Rebuild P2 repo/manifest" tasks - which group and path? How do I know that it has actually done anything?Steenbok
A
3

The 'org.eclipse.equinox.executable.feature.groug' seems to be necessary if you build an eclipse product which includes the native launchers ("include laucher" property set to true in product configuration). Try to add the feature to your platform definition (e.g. copy from eclipse p2 repo or your running eclipse IDE).

See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=407272

Regards, Paolo

Ashburn answered 27/11, 2013 at 21:11 Comment(1)
My Eclipse (Indigo 3.7.2) has "org.eclipse.equinox.launcher_1.2.0.v20110502.jar" and a folder "org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502". The target version of eclipse has "org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar" and a folder "org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731"Steenbok
W
2

To solve the Problem concerning the missing dependencies:

[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'bundle org.eclipse.ui 0.0.0'
          but it could not be found

seems that your Feature/Plugin MyApp requires to download the org.eclipse.ui Plug-in before it can be installed.

You should check your settings from your configuration-pom like this:

 <properties>
  <tycho.version>0.25.0</tycho.version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <repository.url>http://download.eclipse.org/releases/neon</repository.url>
 </properties>

 <repositories>
  <repository>
   <id>NeonRepository</id>
   <url>${repository.url}</url>
   <layout>p2</layout>
  </repository>

if you have set up your self-hosted p2 repository, make sure that the page is correctly build. You can check this if you select(in eclipse) Help -> Install New Software. Eclipse should show the provided parts. If nothing is shown, even if you have deselected every checkbox, you should check your p2-repository. It should contain the "features" and "plugins" container as well as the artifacts.jar and content.jar. If you have only the two folders, you should run

eclipse -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
 -metadataRepository file:/<some location>/repository
 -artifactRepository file:/<some location>/repository
 -source /<location with a site.xml>
 -configs gtk.linux.x86
 -compress
 -publishArtifacts

in a CLI/Shell. For more Information check the eclipse documentation.

Whereby answered 17/8, 2016 at 12:43 Comment(0)
C
0

Can you make maven/tycho instantiate a target platform against which you can build your source plugins? http://www.vogella.com/articles/EclipseTycho/article.html

Chopping answered 4/12, 2013 at 22:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.