I have made a simple RCP application to test Maven builds.
My question is why Maven Tycho can’t find the JDK’s defined in the toolchain and how can I fix those issues?
My RCP plugin uses JDK-15 and I believe that the target-platform brings the dependencies to JDK-11 and JDK-16.
I run ‘mvn clean verify’ and everything seems ok except of following two warnings:
[INFO] --- tycho-p2-publisher-plugin:2.3.0:publish-osgi-ee (default-publish-osgi-ee) @ info.wallberg.my_system.my_product --- [WARNING] No system packages found in profile nor toolchain for JavaSE-11, using current JRE system packages. This can cause faulty dependency resolution, consider adding a definition for a 'jdk' with id=JavaSE-11 in your toolchains.xml [INFO] Published profile IUs: [config.a.jre.javase 11.0.0, a.jre.javase 11.0.0] [INFO] Published profile IUs: [config.a.jre.javase 15.0.0, a.jre.javase 15.0.0] [WARNING] No system packages found in profile nor toolchain for JavaSE-16, using current JRE system packages. This can cause faulty dependency resolution, consider adding a definition for a 'jdk' with id=JavaSE-16 in your toolchains.xml [INFO] Published profile IUs: [config.a.jre.javase 16.0.0, a.jre.javase 16.0.0]
My pom.xml looks like:
<project> <modelVersion>4.0.0</modelVersion> <groupId>info.wallberg.my_system</groupId> <artifactId>info.wallberg.my_system.root</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <properties> <tycho.version>2.3.0</tycho.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- Skip the deployment here, submodules can override this property --> <!--maven.deploy.skip>true</maven.deploy.skip --> </properties> <build> <pluginManagement> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-director-plugin</artifactId> <version>${tycho.version}</version> </plugin> </plugins> </pluginManagement> <plugins> <!--Enable the replacement of the SNAPSHOT version based on the last commit --> <!--<plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-packaging-plugin</artifactId> <version>${tycho.version}</version> <dependencies> <dependency> <groupId>org.eclipse.tycho.extras</groupId> <artifactId>tycho-buildtimestamp-jgit</artifactId> <version>${tycho.version}</version> </dependency> </dependencies> <configuration> <timestampProvider>jgit</timestampProvider> <jgit.ignore>pom.xml</jgit.ignore> <jgit.dirtyWorkingTree>ignore</jgit.dirtyWorkingTree> </configuration> </plugin> --> <!-- Skip the install, since we do not need the artifacts in our local mvn repo --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-maven-plugin</artifactId> <version>${tycho.version}</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-toolchains-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <goals> <goal>toolchain</goal> </goals> </execution> </executions> <configuration> <toolchains> <jdk> <version>11</version> <vendor>oracle</vendor> </jdk> <jdk> <version>15</version> <vendor>oracle</vendor> </jdk> <jdk> <version>16.0.2</version> <vendor>oracle</vendor> </jdk> </toolchains> </configuration> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho.version}</version> <configuration> <executionEnvironment>JavaSE-15</executionEnvironment> <target> <artifact> <groupId>info.wallberg.my_system</groupId> <artifactId>target-platform</artifactId> <version>0.0.1-SNAPSHOT</version> </artifact> </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> <!-- enable source feature generation --> <!--plugin> <groupId>org.eclipse.tycho.extras</groupId> <artifactId>tycho-source-feature-plugin</artifactId> <version>${tycho.version}</version> <executions> <execution> <id>source-feature</id> <phase>package</phase> <goals> <goal>source-feature</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-source-plugin</artifactId> <version>${tycho.version}</version> <executions> <execution> <id>plugin-source</id> <goals> <goal>plugin-source</goal> </goals> </execution> </executions> </plugin <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> <version>3.1.3</version> <configuration> <effort>Max</effort> <threshold>Low</threshold> <failOnError>false</failOnError> </configuration> </plugin> --> </plugins> </build> <modules> <module>bundles</module> <module>features</module> <module>releng</module> <module>tests</module> </modules> </project>
My toolchains.xml looks like:
<?xml version="1.0" encoding="UTF-8"?> <toolchains> <!-- JDK toolchains --> <toolchain> <type>jdk</type> <provides> <version>11</version> <vendor>oracle</vendor> </provides> <configuration> <jdkHome>C:Program FilesJavajdk-11</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>15</version> <vendor>oracle</vendor> </provides> <configuration> <jdkHome>C:Program FilesJavajdk-15</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>16.0.2</version> <vendor>oracle</vendor> </provides> <configuration> <jdkHome>C:Program FilesJavajdk-16.0.2</jdkHome> </configuration> </toolchain> </toolchains>
Advertisement
Answer
Tycho looks for the Execution Environment in an <id>
section in the <provides>
list.
For example, I have:
<toolchain> <type>jdk</type> <provides> <id>JavaSE-16</id> </provides> <configuration> <jdkHome>/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home</jdkHome> </configuration> </toolchain>
For JavaSE-16