Compiling to Java 11

  Written by The Jahia Team
   Estimated reading time:

Jahia 8 modules can be compiled to Java 11. To enable this, you will need to update your pom.xml as indicated below.

First, specify the desired compilation target by adding the following entry:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <release>11</release>
    </configuration>
</plugin>

Then, upgrade the versions of both the maven-bundle-plugin and bndlib that are inherited from the jahia-module pom, to use ones that do support Java 11. This can be accomplished by adding the following entry:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>4.2.1</version>
    <extensions>true</extensions>
    <dependencies>
        <dependency>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>biz.aQute.bndlib</artifactId>
            <version>4.2.0</version>
        </dependency>
    </dependencies>
</plugin>
Warning: Please be aware that modules relying on OSGI blueprint or Spring should not be compiled to Java 11. While compilation would succeed, those modules may not function properly once deployed in Jahia.