使用eclipse开发插件

Developing plug-ins using eclipse

我目前正在尝试开始使用 Eclipse 开发/使用 OSGi 包。问题是 eclipse / OSGi 的组合真的很难设置,而且似乎非常重量级。我用 Activator 创建了一个简单的 "Hello World" 包。我尝试 运行 它作为 "OSGi framework",但我收到了错误/异常的垃圾邮件。首先我得到了很多论文错误:

!ENTRY org.eclipse.update.configurator 4 0 2015-04-18 15:03:31.119
!MESSAGE Could not install bundle plugins/org.eclipse.team.core_3.7.0.v20130514-1224.jar   A bundle is already installed with the name "org.eclipse.team.core" and version "3.7.0.v20130514-1224"

我为 eclipse 附带的每个包都得到了这个。之后我得到以下异常:

org.osgi.framework.BundleException: Exception in org.eclipse.debug.internal.ui.DebugUIPlugin.start() of bundle org.eclipse.debug.ui.
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.

之后我得到一个与码头相关的异常(为什么?)

org.osgi.framework.BundleException: Exception in org.eclipse.equinox.http.jetty.internal.Activator.start() of bundle org.eclipse.equinox.http.jetty.
Caused by: org.osgi.service.cm.ConfigurationException: default : Permission denied
Caused by: java.net.SocketException: Permission denied

让程序打印出来似乎很麻烦"Hello World"。有谁知道如何为插件项目设置eclipse?

好吧,事实证明eclipse在创建新项目时有点草率。在 Juno 中,您可以创建 "Plug-in Project" 或 "Plug-in Development > Plug-in Project"。第一个是 eclipse 插件,后者是一个普通的 OSGi 包。这个名字真是可惜了

我创建了一个新的 OSGi 捆绑包项目、一个新的 "OSGi Framework" 配置并添加了基本要素:

org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.osgi.console

和我自己的捆绑包 (com.vogella.osgi.firstbundle) 到捆绑包。现在一切正常,线程启动并打印到控制台,我可以输入 ss / start 等命令