有osgi.ee包吗

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

我一直在关注 Lars Vogel 的教程 [https://www.vogella.com/tutorials/EclipseTycho/article.html#google_vignette]。我目前陷入 RCP 插件项目的编译错误:

Software being installed: ... requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22))' but it could not be found
。关于这个问题有很多讨论,但我还没有看到解决方案。我想知道 Eclipse 版本:版本:2024-06 (4.32.0) 是否有解决上述问题的方法。大多数关于这个问题的讨论都超出了我的理解范围。以下是我的聚合器 pom 文件:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vogella.tycho</groupId>
    <artifactId>releng</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <properties>
        <tycho.version>4.0.8</tycho.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>

    <!--repositories>
        <repository>
            <id>eclipse</id>
            <url>http://localhost:8080/site</url>
            <layout>p2</layout>
        </repository>

    </repositories-->
    <!--repositories>
    <repository>
      <id>my-repo1</id>
      <name>your custom repo</name>
      <url>https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/javax.annotation</url>
    </repository-->


    <modules>
        <module>MyFeature</module>
        <module>MyPlugin</module>
        <module>updatesite</module>

    </modules>

    <dependencies>

        <!--
        https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
        <!--dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency-->

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>2.1.1</version>
            <scope>provided</scope>
        </dependency>
        <!--dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.annotation</artifactId>
            <version>3.0</version>
        </dependency-->
        <!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.foundation -->
        <!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.core -->
        <!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.minimum -->


    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-director-plugin</artifactId>
                    <version>${tycho.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho.version}</version>
                <extensions>true</extensions>
            </plugin>
            <!--Enable the replacement of the SNAPSHOT version in the final product configuration-->
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-packaging-plugin</artifactId>
                <version>${tycho.version}</version>

                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>package-feature</id>
                        <configuration>

                            <finalName>
                                ${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <pomDependencies>wrapAsBundle</pomDependencies>
                    <!-- Optional set the Java version you are using-->
                    <executionEnvironment>JavaSE-21</executionEnvironment>
                    <target>
                        <file>../TargetDefinition/myTarget.target</file>
                    </target>
                    <environments>
                        <environment>
                            <os>linux</os>
                            <ws>gtk</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>macosx</os>
                            <ws>cocoa</ws>
                            <arch>x86_64</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>
maven eclipse-rcp tycho
1个回答
0
投票

错误

requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22))
意味着插件/包需要 Java 22,因为在其
META-INF/MANIFEST.MF
中包含
Bundle-RequiredExecutionEnvironment: JavaSE-22
行,该行在您的 Maven/Tycho 构建中不可用:在您的 POM 中进行配置
target-platform-configuration
您指定了
<executionEnvironment>JavaSE-21</executionEnvironment>
,因此出现错误。

使用以下其中一个解决方案(我会推荐第一个解决方案,因为与 Java 21 相比,Java 22 没有提供长期支持):

    假设导致错误的插件/包是您的代码,
  • 通过在其 META-INF/MANIFEST.MF 文件中将行
    Bundle-RequiredExecutionEnvironment: JavaSE-22
    更改为
    Bundle-RequiredExecutionEnvironment: JavaSE-22
    ,将插件/包从 Java 22 降级到 21
  • 在 POM 中将
  • <executionEnvironment>JavaSE-21</executionEnvironment>
     更改为 
    <executionEnvironment>JavaSE-22</executionEnvironment>
    (并确保使用 Java 22 或更高版本运行 Maven 构建)
  • 在 POM 中将
  • <executionEnvironment>JavaSE-21</executionEnvironment>
     更改为 
    <resolveWithExecutionEnvironmentConstraints>false</resolveWithExecutionEnvironmentConstraints>
    (并确保使用 Java 或更高版本运行 Maven 构建)
另请参阅

Tycho org.eclipse.tycho:target-platform-configuration

 文档

© www.soinside.com 2019 - 2024. All rights reserved.