未知的 OSGi 执行环境:“JavaSE-21”

问题描述 投票:0回答:1

我尝试从

Java 17
o
Java 21
升级 Eclipse RCP 项目。该项目目前正在使用 Eclipse Target Platform
2023-12

2023-12.目标

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="Retrospective (2023-12)">
    <locations>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="http://download.eclipse.org/releases/2023-12/"/>
            <unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
            <unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
        </location>
    </locations>
</target>

pom.xml

...
<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-maven-plugin</artifactId>
    <version>${tycho-version}</version>
    <extensions>true</extensions>
</plugin>
<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho-version}</version>
    <configuration>
        <resolver>p2</resolver>
        <target>
            <artifact>
                <groupId>com.retrospective</groupId>
                <artifactId>com.retrospective.target</artifactId>
                <version>6.2.0</version>
                <classifier>2023-12</classifier>
            </artifact>
        </target>
        ...

到目前为止我做了什么:

  • 在 Eclipse 中切换到
    Java 21 JDK
  • 更新了
    pom.xml
    .product
    文件中的项目版本
  • -Dosgi.requiredJavaVersion=21
    文件中定义
    .product
  • 升级
    maven
    至版本3.9.6
  • 升级
    tycho
    至版本4.0.5
  • 在所有
    Bundle-RequiredExecutionEnvironment: JavaSE-21
    文件中定义
    MANIFEST.MF
  • 更新了一些库的版本
  • 在 Eclipse 中编译项目并在我的计算机上成功启动应用程序

当我将更改推送到 GIT 时,

CI/CD
构建作业启动但会产生错误。我在本地运行
mvn clean verify -e
时可以重现相同的错误:

Unknown OSGi execution environment: 'JavaSE-21'
org.eclipse.tycho.core.ee.UnknownEnvironmentException: Unknown OSGi execution environment: 'JavaSE-21'
    at org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils.getExecutionEnvironment (ExecutionEnvironmentUtils.java:102)
    at org.eclipse.tycho.core.osgitools.OsgiBundleProject.applyBestOfCurrentOrConfiguredProfile (OsgiBundleProject.java:642)
    at org.eclipse.tycho.core.osgitools.OsgiBundleProject.readExecutionEnvironmentConfiguration (OsgiBundleProject.java:617)
    at org.eclipse.tycho.core.TychoProjectManager.lambda$getExecutionEnvironmentConfiguration$0 (TychoProjectManager.java:118)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject$LazyValue.get (DefaultReactorProject.java:307)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject.computeContextValue (DefaultReactorProject.java:200)
    at org.eclipse.tycho.core.TychoProjectManager.getExecutionEnvironmentConfiguration (TychoProjectManager.java:112)
    at org.eclipse.tycho.p2resolver.P2DependencyResolver.lambda$getPreliminaryTargetPlatform$3 (P2DependencyResolver.java:214)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject$LazyValue.get (DefaultReactorProject.java:307)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject.computeContextValue (DefaultReactorProject.java:200)
    at org.eclipse.tycho.p2resolver.P2DependencyResolver.getPreliminaryTargetPlatform (P2DependencyResolver.java:209)
    at org.eclipse.tycho.core.osgitools.AbstractTychoProject.lambda$getDependencyArtifacts$0 (AbstractTychoProject.java:83)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject$LazyValue.get (DefaultReactorProject.java:307)
    at org.eclipse.tycho.core.osgitools.DefaultReactorProject.computeContextValue (DefaultReactorProject.java:200)
    at org.eclipse.tycho.core.osgitools.AbstractTychoProject.getDependencyArtifacts (AbstractTychoProject.java:77)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:98)
    at org.eclipse.tycho.core.maven.TychoProjectExecutionListener.beforeProjectLifecycleExecution (TychoProjectExecutionListener.java:111)
    at org.apache.maven.lifecycle.internal.CompoundProjectExecutionListener.beforeProjectLifecycleExecution (CompoundProjectExecutionListener.java:42)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:103)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)

我忘记了哪个重要的迁移步骤?

maven osgi eclipse-rcp tycho java-21
1个回答
0
投票

确保使用 Java 21 运行 CI/CD Maven 构建

要在日志开头获取 Maven 和 Java 的版本,请使用 Maven 命令行选项

-V
--show-version

一般来说,对于 CI/CD Maven 构建,以下选项可能会有所帮助:

  • -V
    - 在不停止构建的情况下显示 Maven 和 Java 版本信息
  • -ntp
    - 下载或上传时不显示传输进度
  • -fae
    - 仅在之后构建失败;允许所有不受影响的构建继续
© www.soinside.com 2019 - 2024. All rights reserved.