-
Notifications
You must be signed in to change notification settings - Fork 198
Compiling code for older java releases
Christoph Läubrich edited this page Feb 6, 2025
·
4 revisions
Tycho requires Java 17 to run the build, but you can still use older jdks to build your code using toolchains. Just keep in mind the following:
- Compiling for old releases is made available on a best effort basis and support for non-modular JVM (JDK < 9) will likely be dropped in Tycho 3.x line
- If you still need to compile legacy code, it might be easier to simply use an older
tycho-version
from maven central. - If you find a bug the best is to provide a good small reproducer and be prepared that if you don't provide a fix or pay someone to do so it is very unlikely it will ever get fixed.
Tycho contains one example of an integration test that is using a JDK8 you can find it here, the important parts are:
- make sure you have a toolchain.xml setup to point to a true Java 8 JDK, see an example here.
- Make sure your bundle contains a
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
- configure the
tycho-compiler-plugin
with at least the following settings (see Issue #51):
<useJDK>BREE</useJDK>
<deriveReleaseCompilerArgumentFromTargetLevel>false</deriveReleaseCompilerArgumentFromTargetLevel>
For general configuration of the compiler see here, since version 3.39.0 of ECJ it does no longer support target levels < 1.8 if you need that configure Tycho like that:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.38.0</version>
</dependency>
</dependencies>
</plugin>