Tycho and Eclipse: How to resolve OSGI dependencies to my own bundles at development time within Eclipse, without opening all of them in the IDE

白昼怎懂夜的黑 提交于 2019-11-30 00:47:35

The "most automated" way to configure your target platform in Eclipse is to use a target file. That file can be checked in with your sources, so every developer only needs to open the file and click on "Set as Target Platform" to activate it. AFAIK there is no m2e connector or Eclipse plug-in which does that automatically.

Given your development process, setting up this target file is a little more tricky. Since you don't have a feature which contains the latest version of all your bundles, you need to include the bundles directly in the target file. This is not possible via the rich editor, but can be done with a text editor:

  1. Create a target definition file, add your p2 repository, and select any feature from that p2 repository. Save the file.
  2. Open the target file in a text editor, remove the <unit> entry for the feature you added.
  3. Instead, add an entry for each of your bundles:

    <unit id="a.bundle.symbolic.name" version="0.0.0"/>
    

This target file then contains the latest version of each of the listed bundles. To see the content, open the file with the "Target Editor" again and switch to the "Content" tab. This file can now be used by all developers.

Note: When a new version of one of the bundles is deployed to Nexus, the developers will only see that new version if they open the target file and choose "Set as Target Platform" again.

As indicated by Nick Wilson, you will need to install the m2e Tycho Configurator, which basically "links up" Eclipse and Tycho (i.e., makes Tycho available in Eclipse).

You should've been pointed towards it after having installed m2e, but you can also install it manually:

  1. Go to Window > Preferences > Maven > Discovery.

  2. Click the "Open Catalog" button. This will open the "m2e Marketplace" window.

  3. Search for "tycho", this should give you the "Tycho Configurator" as sole search result.

  4. Click "Finish", you're done.

I've had this issue as well, and it isn't simple to find the solution, so I hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!