Java 10 — migration story

gimlet2

Andrei

Posted on March 27, 2018

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.

💖 💪 🙅 🚩
gimlet2
Andrei

Posted on March 27, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Java 10 — migration story
softwaredevelopment Java 10 — migration story

March 27, 2018