Update your Plugin Project for JDK 17+
Author:
Lesley Dean
Changed on:
18 Apr 2024
Key Points
- A step-by-step guide to update your plugin Project for SDK 17+
Prerequisites
Steps
Prerequisites
- 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 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
5. On Project, make sure SDK 17 is selected, and Language level set to “SDK default”
6. On Modules, make sure Language Level is set to 8
7. Click Apply and OK
Step 2: Update your pom.xml file Plugins and Dependencies
- In the Project window, open the file
`pom.xml`
- Under , update the following:
`<properties>`
- 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>`
- Update the Mockito version:
- Under , locate the existing mockito-all dependency, and update it to mockito-inline:
`<dependencies>`
<dependency>
<groupId>org.mockito</groupId>
<!-- <artifactId>mockito-all</artifactId> -->
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency> - Under , locate the Lombok plugin, and update the version:
`<build><plugins>`
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 , locate the Maven Compiler Plugin, and update the version:
`<build><plugins>`
<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>
What'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.