Backend Development 12 min read

Resolving Maven Compilation Hang After Upgrading Spring Cloud from Java 8 to Java 11 and Dealing with Lombok @Builder.Default Issues

The article explains why a Spring Cloud project upgraded from Java 8 to Java 11 gets stuck during Maven compilation, shows how to enable detailed compiler logs with Maven‑compiler‑plugin settings, presents the lengthy compilation output, and advises cautious use of Lombok’s @Builder.Default to avoid similar hangs.

Cognitive Technology Team
Cognitive Technology Team
Cognitive Technology Team
Resolving Maven Compilation Hang After Upgrading Spring Cloud from Java 8 to Java 11 and Dealing with Lombok @Builder.Default Issues

A Spring Cloud project was upgraded from Java 8 to Java 11, after which the Maven build consistently hung during compilation.

To investigate, the Maven compiler plugin was configured to produce verbose output, disable incremental compilation, show warnings, and set the debug level to lines,vars,source :

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <verbose>true</verbose>
                <useIncrementalCompilation>false</useIncrementalCompilation>
                <showWarnings>true</showWarnings>
                <debuglevel>lines,vars,source</debuglevel>
            </configuration>
        </plugin>
    </plugins>
</build>

With these options enabled, the full compilation log was captured, showing the processing of source files, module loading steps, classpath resolution, and several annotation‑processing cycles. The log demonstrates that the build spends a considerable amount of time loading JDK modules and Spring libraries before finally writing the compiled classes.

In the actual project the compilation was repeatedly blocked on a class annotated with @lombok.Builder.Default . Removing this annotation allowed the build to finish, indicating that Lombok’s annotation processor was the source of the hang.

Because the exact internal handling of the annotation processor is not traced, the author recommends limiting Lombok usage to simple getters, setters, and constructors, and avoiding more complex code generation such as @Builder.Default when possible.

In summary, when encountering Maven compilation stalls after a Java version upgrade, enable detailed compiler logging, examine the output for problematic annotation processors, and consider simplifying Lombok usage to resolve the issue.

Backend DevelopmentCompilationMavenSpring CloudLombokJava 11
Cognitive Technology Team
Written by

Cognitive Technology Team

Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.