Fluent Commerce Logo
Docs
Sign In

Update your Plugin Project for JDK 17+

How-to Guide

Author:

Lesley Dean

Changed on:

18 Apr 2024

Key Points

  • A step-by-step guide to update your plugin Project for SDK 17+

Steps

Step arrow right iconPrerequisites

  • A fully setup and functioning Fluent Account
  • Setup your Development Environment
  • You have installed a JDK version later than JDK 8, and it is active on your system path. (Note: Tested with JDK 17)
  • You have installed a Maven version later than Maven 3.6.*, and it is active on your system path. (Note: Tested with Maven 3.9.2)
  • Create a new Rules Plugin Project

Step arrow right iconStep 1: Checking and Updating your IntelliJ Settings

1. Open IntelliJ, and click Open…

2. Navigate to the plugin project you have just generated from the install scripts, and click Open

3. Right click on the project root, and click Open Module Settings

4. Under Platform Settings, make sure that JDK 17 is available. If not, you will need to add it using the plus ➕ sign button

No alt provided

5. On Project, make sure SDK 17 is selected, and Language level set to “SDK default”

No alt provided

6. On Modules, make sure Language Level is set to 8 

No alt provided

7. Click Apply and OK



Step arrow right iconStep 2: Update your pom.xml file Plugins and Dependencies

  • In the Project window, open the 
    `pom.xml`
     file
  • Under 
    `<properties>`
    , update the following:
    • Update the Mockito version: 
      `<mockito.version>5.2.0</mockito.version>`


      Note: The Rules SDK course previously used PowerMock for mocking and stubbing final objects, however this has been removed, so if you have any PowerMock dependencies, you should remove them, and reimplement your unit tests using Mockito’s mocking, or follow the latest version of the Rules SDK course.
    • Update the Lombok version:
      `<lombok.version>1.18.20</lombok.version>`


  • Under 
    `<dependencies>`
    , locate the existing mockito-all dependency, and update it to mockito-inline:

    <dependency>
       <groupId>org.mockito</groupId>
       <!-- <artifactId>mockito-all</artifactId> -->
       <artifactId>mockito-inline</artifactId>
       <version>${mockito.version}</version>
       <scope>test</scope>
    </dependency>

  • Under 
    `<build><plugins>`
    , locate the Lombok plugin, and update the version:

    Note: The plugin version is slightly different to the dependency version!

    <plugin>
       <groupId>org.projectlombok</groupId>
       <artifactId>lombok-maven-plugin</artifactId>
       <!-- <version>1.16.8.0</version>-->
       <!-- For JDK 17 -->
       <version>1.18.20.0</version>
       <executions>
           <execution>
               <phase>generate-sources</phase>
               <goals>
                   <goal>delombok</goal>
               </goals>
           </execution>
       </executions>
    </plugin>

  • Also under 
    `<build><plugins>`
    , locate the Maven Compiler Plugin, and update the version:


    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <!--  use 3.5 to work with 1.8 jdk -->
       <!-- <version>3.5.1</version>-->
       <!-- For JDK 17 -->
       <version>3.8.0</version>
       <configuration>
           <target>1.8</target>
           <source>1.8</source>
       </configuration>
    </plugin>


Step arrow right iconWhat's Next?

Your Plugin should now work with JDK 17 and Maven 3.9.2, and you can continue with the Write your first Custom Rule (Hello World) step.

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo