Eclipse RCP 在启动时崩溃

Eclipce RCP is crashed when starting

我使用旧的遗留项目并尝试将其切换到 Java11。 目前可以编译成功,但是一启动就闪退

该项目由几个eclipse插件模块和最终的eclipse-repository模块组成,其中包含产品文件(还有pom文件编译所有模块并在eclipse-repository模块的目标文件夹中创建可执行文件)

目标定义文件也已成功解析,看起来像

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="phoenixldm-artifactory-p2" sequenceNumber="259">
  <locations>

    <location includeAllPlatforms="true" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="http://download.eclipse.org/releases/2019-09"/>
        <unit id="org.eclipse.birt.feature.group" version="4.7.0.v201706222054"/>
    </location>
        
    <location includeAllPlatforms="true" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="http://download.eclipse.org/releases/2020-12"/>
        <unit id="org.eclipse.equinox.sdk.feature.group" version="3.21.0.v20201128-0731"/>
        <unit id="org.eclipse.sdk.feature.group" version="4.18.0.v20201202-1800"/>
        <unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="3.20.0.v202011230434"/>
        <unit id="org.eclipse.jst.web_ui.feature.feature.group" version="3.20.0.v202011230434"/>
        <unit id="org.eclipse.pde.feature.group" version="3.14.600.v20201202-1800"/>
        <unit id="org.eclipse.wst.web_ui.feature.feature.group" version="3.20.0.v202011230431"/>
        <unit id="org.eclipse.wst.xml_ui.feature.feature.group" version="3.20.0.v202011230430"/>
    </location>

 <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="https://artifactory.in.XXX.com/artifactory/YYY/platform"/>
        <unit id="com.company.orm.platform.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.orm.platform.feature.source.feature.group" version="2.1.2"/>
    </location>

    <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="https://artifactory.in.XXX.com/artifactory/YYY/application"/>
        <unit id="com.company.orm.core.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.orm.core.feature.source.feature.group" version="2.1.2"/>
        <unit id="com.company.update.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.update.feature.source.feature.group" version="2.1.2"/>
    </location>
    
  </locations>
    
</target>

我正在使用两个版本的 eclipse:最新的 2020-12 和 2019-09,因为这是我们项目中使用的 BIRT 的最新版本。

我的产品文件是面向功能的,所以产品文件看起来像

<product name="Noname" uid="noname" version="1.1.1" useFeatures="true" includeLaunchers="true">

   <configIni use="default">
   </configIni>

   <launcherArgs>
      <programArgsLin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog
      </programArgsLin>
      <programArgsWin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog
      </programArgsWin>
      <vmArgsLin>-Xmx2048m -Xms512m -XX:+UseParallelGC -Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgsLin>
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
      </vmArgsMac>
      <vmArgsWin>-Xmx768m -Xms256m -Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgsWin>
   </launcherArgs>

   <windowImages/>

   <launcher name="phoenix">
      <win useIco="false">
         <bmp/>
      </win>
   </launcher>

   <vm>
   </vm>

   <plugins>
   </plugins>

   <features>
      <feature id="com.company.comp.feature"/>
      <feature id="com.company.orm.core.feature"/>
      <feature id="com.company.orm.platform.feature"/>
      <feature id="org.eclipse.pde"/> <!-- added because can't find org.eclipse.equinox.simpleconfigurator -->
   </features>

     <configurations>
      <!-- all plug-ins from my features above -->
      <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
   </configurations>

   <preferencesInfo>
      <targetfile overwrite="false"/>
   </preferencesInfo>

   <cssInfo>
   </cssInfo>

</product>

pom文件中有插件

<build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-director-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

为产品创建可执行文件。 如果我启动可执行文件,我会得到“Segmetation fault” 当我以 运行 配置 - Eclipse 应用程序启动它时,它会崩溃并显示日志

!ENTRY org.eclipse.equinox.launcher 4 0 2021-01-30 12:46:42.659
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:650)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1434)

不幸的是,我不确定我做的每件事都是正确的。可能有人可以告诉我哪里错了。

在我看来,我找到了问题的根本原因。至少我的应用程序可以 运行ning 而不会崩溃到分段错误。不幸的是,它仍然抱怨未解决的依赖关系,但这是向前迈出的一大步。 所以,问题出在 <programArgsLin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog 在我的产品文件中。

删除 -os ${target.os} -ws ${target.ws} -arch ${target.arch} 让申请 运行.

谢谢@greg-449,你说得对 org.eclipse.pde - 这不是我需要的功能。

我重构了我的产品,它看起来像

...
<launcherArgs>
      <programArgs>-consoleLog
      </programArgs>
      <vmArgs>-Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgs>
      <vmArgsLin>
         <argsX86_64>-Xmx2048m -Xms512m -XX:+UseParallelGC</argsX86_64>
      </vmArgsLin>
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
      </vmArgsMac>
      <vmArgsWin>-Xmx768m -Xms256m
      </vmArgsWin>
   </launcherArgs>
...
<vm>
      <linux include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</linux>
      <macos include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</macos>
   </vm>
...
<features>
      ... list of my features ...
      <feature id="org.eclipse.e4.rcp" installMode="root"/>
      <feature id="org.eclipse.emf.ecore" installMode="root"/>
      <feature id="org.eclipse.emf.common" installMode="root"/>
</features>
<configurations>
      <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
   </configurations>