Search code examples
maveneclipse-rcptycho

Is there an osgi.ee package


I have been following the tutorial by Lars Vogel [https://www.vogella.com/tutorials/EclipseTycho/article.html#google_vignette]. I am currently stuck on a compilation error for the RCP plugin project : Software being installed: ... requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22))' but it could not be found. There is plenty of talk about it but I am yet to see the solution. I am wondering if the Eclipse version : Version: 2024-06 (4.32.0) does have a solution to the above mentioned issue. Most conversation about the problem are on the level that is beyond my comprehension. Below is my aggregator pom file:

<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>

Solution

  • The error requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22)) (osgi.ee: OSGi execution environment) means that a plugin/bundle requires Java 22 by having in its META-INF/MANIFEST.MF the line Bundle-RequiredExecutionEnvironment: JavaSE-22, which is not made available in your Maven/Tycho build: in your POM, in the configuration of the target-platform-configuration you specified <executionEnvironment>JavaSE-21</executionEnvironment>, hence the error.

    Use one of the following solutions (I would recommend the first solution since no long time support is provided for Java 22 in contrast to Java 21):

    • Assuming the plugin/bundle causing the error is your code, downgrade the plugin/bundle from Java 22 to 21 by in its META-INF/MANIFEST.MF file changing the line Bundle-RequiredExecutionEnvironment: JavaSE-22 to Bundle-RequiredExecutionEnvironment: JavaSE-21
    • Increase the execution environment Java version: In your POM change <executionEnvironment>JavaSE-21</executionEnvironment> to <executionEnvironment>JavaSE-22</executionEnvironment> (and make sure to run your Maven build with Java 22 or higher)
    • Ignore validating the execution environment Java version: In your POM change <executionEnvironment>JavaSE-21</executionEnvironment> to <resolveWithExecutionEnvironmentConstraints>false</resolveWithExecutionEnvironmentConstraints> (and make sure to run your Maven build with Java or higher)

    See also Tycho org.eclipse.tycho:target-platform-configuration documentation.