Quick revision
The short answer
We raise maven.compiler.release, or java.version with the Spring Boot parent, to 25, and update the compiler, Surefire and Failsafe plugins plus every tool that reads or instruments bytecode, such as JaCoCo, ASM-based plugins, shade, Lombok and Mockito with Byte Buddy, because old versions fail on Java 25 class files. Annotation processors must be declared in annotationProcessorPaths, since newer JDKs no longer run processors found only on the classpath by default. We roll out through the shared parent: run the tests on the new runtime first, pilot with a few services, then the rest, watching warnings such as sun.misc.Unsafe memory access deprecations.
What to remember
In this answer, we saw that moving to Java 25 means raising release or java.version in the shared parent and updating the compiler, Surefire and Failsafe plugins along with every bytecode tool, JaCoCo, shade, Lombok, Mockito and Byte Buddy, which fail on class file version 69 when they are old. Annotation processors must be declared in annotationProcessorPaths on newer JDKs. We rolled out in two steps, tests on the new runtime first and release level second, through the parent with a pilot group, watching warnings along the way.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We raise maven.compiler.release, or java.version with the Spring Boot parent, to 25, and update the compiler, Surefire and Failsafe plugins plus every tool that reads or instruments bytecode, such as JaCoCo, ASM-based plugins, shade, Lombok and Mockito with Byte Buddy, because old versions fail on Java 25 class files. Annotation processors must be declared in annotationProcessorPaths, since newer JDKs no longer run processors found only on the classpath by default. We roll out through the shared parent: run the tests on the new runtime first, pilot with a few services, then the rest, watching warnings such as sun.misc.Unsafe memory access deprecations.
Why this question is asked
Moving from one Java LTS to the next is mostly predictable work, but across 30 services it fails in many small ways at once: a coverage tool that cannot read new class files, a code generator that silently stops running, a test library that prints warnings that become errors in the next release. Interviewers ask this to see whether we know where the breakage comes from and can organise the change so it does not stall. In this answer, we will see which build settings change, which plugins must be updated and why, what changed in annotation processing, and how to roll it out in stages.
1What Changes Between Java 17 and 25
Java 25 is the next long-term support release after 21, so this move skips one LTS. For the build, three kinds of change matter. The class file version moves from 61 for Java 17 to 69 for Java 25, and every tool that reads class files must understand the new version. Several defaults of javac and the JVM changed along the way, such as annotation processing and warnings for dynamically loaded agents. And some old APIs are deprecated, restricted or removed, such as the memory-access methods of sun.misc.Unsafe, which are deprecated for removal and now produce runtime warnings, and the Security Manager, which is permanently disabled since Java 24.
Our application code usually needs few changes. The build tooling needs more, which is why we start there.
2The Compiler Setting and the Core Plugins
The language level is a single property in the shared parent. If the parent inherits from spring-boot-starter-parent, it is java.version; otherwise it is maven.compiler.release. Along with it, we update maven-compiler-plugin, maven-surefire-plugin and maven-failsafe-plugin to recent versions that are tested with the new JDK. Spring Boot 3.5 and 4.0 support Java 25, and their parents already manage recent versions of these plugins, which is one more reason to upgrade Spring Boot first or at the same time.
Notice the error at the end. It is the typical failure of a bytecode tool that predates the new JDK: it reads the class file header, sees version 69 and gives up. The same message, or a close cousin, comes from shade, from code generators built on an old ASM, and from Byte Buddy.
3Every Tool That Reads or Changes Bytecode
Beyond the core plugins, we list every tool that touches class files and check the release notes for Java 25 support. JaCoCo instruments classes for coverage. The shade plugin and other packaging plugins relocate classes using ASM. Lombok hooks into javac itself and is often the first thing to break on a new JDK. Mockito creates mocks with Byte Buddy, which must know the new class file version; old versions fail unless we set an experimental flag, and the right fix is upgrading. Mockito's inline mock maker also loads a Java agent dynamically, which newer JDKs warn about, so recent Mockito documentation recommends adding it as a -javaagent in the Surefire configuration.
The reason to do this list up front is that these failures appear in different modules and at different phases, and fixing them one at a time across 30 services is slow. Fixing their versions once in the parent fixes them everywhere.
| Tool | Why it breaks | What to do |
|---|---|---|
| maven-compiler-plugin | Old versions do not know release 25 | Recent version, managed in the parent |
| Surefire and Failsafe | Test JVM options and module handling | Recent versions |
| JaCoCo | Cannot instrument class file version 69 | Release with Java 25 support |
| Shade, ASM-based plugins | Old ASM rejects new class files | Recent versions |
| Lombok | Hooks into javac internals | Release with Java 25 support |
| Mockito and Byte Buddy | New class files, agent loading warnings | Upgrade; javaagent in Surefire |
4Annotation Processors Must Be Declared
Annotation processors such as Lombok, MapStruct and Hibernate's metamodel generator used to run automatically whenever their jar was on the compile classpath. Starting with JDK 23, javac no longer does that by default: unless processors are configured explicitly, annotation processing is off. The build then fails in confusing ways, such as missing generated classes or 'cannot find symbol' on Lombok getters. Check your JDK version for the exact behaviour, but the fix works on all of them: declare the processors in annotationProcessorPaths.
Doing this in the parent has a side benefit: the processors are explicit and versioned in one place, instead of each service relying on whatever happens to be on its classpath.
5Rolling It Out Across 30 Services
We split the move into two steps that can be undone separately. First, we run on the new runtime while still compiling for 17: CI images or toolchains provide both JDKs, every service runs its full test suite on Java 25 with release still at 17, and we fix what fails, mostly plugin and library versions. This step changes nothing for production. Second, we raise the release level to 25 in the parent, which lets teams use new language features.
Both steps go through the shared parent with a pilot group of three or four services that cover the main patterns: one with heavy code generation, one with many mocks, one with native libraries. Once they are green and deployed, an update bot opens the parent bump in the other services. Throughout, we watch the build and runtime logs for new warnings, such as the sun.misc.Unsafe memory-access warnings and dynamic agent warnings, because today's warnings are the next release's errors.
- Update parent plugins and librariescompiler, Surefire, JaCoCo, Lombok, Mockito
- Run all tests on Java 25 with release 17both JDKs in CI images or toolchains
- Pilot services green and deployed?YesRaise release to 25 in the parentNoFix the failures and repeat
- Bot opens parent bump in all servicestrack progress per service
- Watch warnings in builds and logsUnsafe memory access, agents
5 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Should we upgrade Spring Boot at the same time?
If services are on a Spring Boot version that does not support Java 25, yes, and it should come first or together, because Boot's parent manages many of the plugin and library versions we need. If they are already on a supported version, keeping the Java upgrade separate makes failures easier to attribute.
What if one service cannot move yet because of a library?
It stays on its current parent version, or overrides the Java level, with a documented exception and a date. The rest of the fleet should not wait for it. Often the blocker is a library that needs a newer release, and the exception record is where we track that.
Do the container images need to change?
Yes. The runtime image must have Java 25, and JVM options in the deployment, such as memory flags or removed options, need a review. Running the tests on Java 25 catches most code issues, but a short soak in a test environment with production-like settings catches option and performance surprises.
7Conclusion
In this answer, we saw that moving to Java 25 means raising release or java.version in the shared parent and updating the compiler, Surefire and Failsafe plugins along with every bytecode tool, JaCoCo, shade, Lombok, Mockito and Byte Buddy, which fail on class file version 69 when they are old. Annotation processors must be declared in annotationProcessorPaths on newer JDKs. We rolled out in two steps, tests on the new runtime first and release level second, through the parent with a pilot group, watching warnings along the way.
Open with
I would treat it as mostly a build-tooling upgrade, done once in the shared parent. The settings change is small: java.version to 25 if we inherit from the Spring Boot parent, or maven.compiler.release otherwise, plus recent versions of the compiler, Surefire and Failsafe plugins, and a Spring Boot version that supports Java 25.
Then, if they want more
The bigger work is every tool that reads or rewrites bytecode, because Java 25 class files are version 69 and old tools fail with unsupported class file major version.
That means JaCoCo, the shade plugin and anything using an old ASM, Lombok, and Mockito with Byte Buddy, where I would also add Mockito as a javaagent in Surefire because of the dynamic agent warnings.
Another trap is annotation processing: newer JDKs no longer run processors just because they are on the classpath, so I would declare Lombok, MapStruct and the like in annotationProcessorPaths. For the rollout, I would first run every service's tests on Java 25 while still compiling with release 17, using CI images or toolchains with both JDKs, and fix the failures.
Then I would raise the release level in the parent. Both steps go to a pilot group of three or four varied services, and then a bot opens the parent bump everywhere. Along the way I would watch for warnings like the sun.misc.Unsafe memory-access ones, since they become errors later.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 25, Java 17, Java 23, Java 24
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Maven guides
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "You are moving 30 services from Java 17 to Java 25. What Maven build settings and plugin...": https://scrivio-interview-library.netlify.app/java/maven/bfee92d706/