DEV Community

Andrei
Andrei

Posted on • Originally published at Medium on

Java 10 — migration story

As you probably know Java 10 was recently released. Not so many new features. At least for Kotlin developers… But there are several improvements to JVM itself. And, I guess, there will be more in upcoming versions. Which we will get twice a year from now! So, I think it is better to take some time and sync your projects to make it easier in future to migrate with the same speed.

The main project I’m involved into is SpringBoot 1.5.X based service made with Kotlin and it uses Postgres as a data base. At this moment it uses Java 8. Such a great chance to skip Java 9 and jump directly to 10! Being inspired by this thought I have opened my laptop.

I use SDKman to install Java but for Java 10 it delivers broken version for some unknown reason. So this time I had to download bundle from the official website manually.

The biggest issue is that some libraries are no longer part of JDK. That is good news — it is getting cleaner. But as a result, you need to define additional dependencies for your project. You can also include them with command line parameters since they are actually still in JDK but I think it is better to move them into dependencies because as far as I’ve understood they gonna be removed in future releases completely. In my case it was:

The second issue was Jacoco Gradle plugin. If you use it to measure the code coverage there is good news— Jacoco itself supports Java 10. But to make Jacoco Gradle plugin work I had to specify the tool version like this in my gradle build file:

And the last part that was broken — Mockito. That issue could be solved by adding a fresh version of Bytebuddy library like this:

After these modifications, I was able to build and run my project and all tests were green. Don’t be afraid to migrate! Next step would be to prepare Dockerbuild file. But that is a topic for the next article.

Top comments (3)

Collapse
 
martinhaeusler profile image
Martin Häusler

Did the module system introduced in Java 9 get in your way? I heard that there are some pain-points with reflection-heavy frameworks like Spring and Hibernate.

Collapse
 
gimlet2 profile image
Andrei

Wasn't a case for me so far. Maybe I'll face it later =)

Collapse
 
stealthmusic profile image
Jan Wedel

I had so many troubles even migrating from 8 to 9 that I didn't dare to try 10. Currently were back to 8 :(