Sonarlink 插件未在 Eclipse 中安装

Posted

技术标签:

【中文标题】Sonarlink 插件未在 Eclipse 中安装【英文标题】:Sonarlink plugin not getting installed in eclipse 【发布时间】:2021-12-04 15:57:35 【问题描述】:

我正在尝试从 Eclipse 市场安装 sonarlint 插件。安装后,它显示为已安装在 eclipse 市场中。但是,重新启动 eclipse 后报告以下错误。你能帮忙吗?我已经安装了2020-03 version of eclipse,但仍然是同样的问题。有人可以帮忙

错误 -1

!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.sonarlint.eclipse.cdt [484]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; resolution:="optional"
  Unresolved requirement: Require-Bundle: org.sonarlint.eclipse.core
    -> Bundle-SymbolicName: org.sonarlint.eclipse.core; bundle-version="7.0.0.37874"; singleton:="true"
       org.sonarlint.eclipse.core [485]
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"
         Unresolved requirement: Require-Bundle: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="5.1.0"
           -> Bundle-SymbolicName: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="7.0.0.37656"
              org.sonarsource.sonarlint.core.sonarlint-core [489]
                Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"
  Unresolved requirement: Require-Bundle: org.sonarsource.sonarlint.core.sonarlint-core
    -> Bundle-SymbolicName: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="7.0.0.37656"

    at org.eclipse.osgi.container.Module.start(Module.java:462)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1844)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1837)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1778)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1742)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1664)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

错误 -2

!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.sonarlint.eclipse.core [485]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"
  Unresolved requirement: Require-Bundle: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="5.1.0"
    -> Bundle-SymbolicName: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="7.0.0.37656"
       org.sonarsource.sonarlint.core.sonarlint-core [489]
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

    at org.eclipse.osgi.container.Module.start(Module.java:462)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1844)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1837)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1778)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1742)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1664)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

错误 -3

!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.sonarlint.eclipse.jdt [486]
  Unresolved requirement: Require-Bundle: org.sonarlint.eclipse.core
    -> Bundle-SymbolicName: org.sonarlint.eclipse.core; bundle-version="7.0.0.37874"; singleton:="true"
       org.sonarlint.eclipse.core [485]
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"
         Unresolved requirement: Require-Bundle: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="5.1.0"
           -> Bundle-SymbolicName: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="7.0.0.37656"
              org.sonarsource.sonarlint.core.sonarlint-core [489]
                Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"
  Unresolved requirement: Require-Bundle: org.sonarsource.sonarlint.core.sonarlint-core
    -> Bundle-SymbolicName: org.sonarsource.sonarlint.core.sonarlint-core; bundle-version="7.0.0.37656"

    at org.eclipse.osgi.container.Module.start(Module.java:462)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1844)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1837)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1778)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1742)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1664)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

【问题讨论】:

【参考方案1】:

关键信息是

Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

这是说 Eclipse 必须使用 Java 11 或更高版本运行。

【讨论】:

好的,谢谢,我在哪里指定版本?在 -vm 部分的 eclipse.ini 中? 是的,eclipse.ini 中的 -vm。当前的大多数 Eclipse 下载都包含内置的 Java 15。 在此之前这不会失败吗?听起来这个人能够启动 Eclipse,然后尝试安装插件。如果他们不使用 Java 11 运行它,他们应该无法做到这一点。 @DavidM.Karr 是他们安装的插件需要Java 11,不同的插件可能需要不同级别的Java。您可以安装需要比您正在运行的版本更新的 Java 版本的插件,但它们在启动时会出现此错误。 @DavidM.Karr 您可能会想到 eclipse.ini 中的 -Dosgi.requiredJavaVersion=11 条目,它可以让启动代码快速检查 Java 版本

以上是关于Sonarlink 插件未在 Eclipse 中安装的主要内容,如果未能解决你的问题,请参考以下文章

在eclipse中安装SVN插件失败

怎么在eclipse中安装properties插件

Qt 设计器插件未在 Eclipse CDT 中加载

如何在eclipse中安装testng插件

eclipse中安装adt插件

Eclipse中安装SVN插件