Skip to content

Exclude spring-boot-devtools from AOT processing in Maven #46533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

academey
Copy link

This PR ensures that spring-boot-devtools is excluded from AOT processing when building native images with Maven, matching the existing behavior in Gradle.

Problem:
When building native images with Maven, spring-boot-devtools remains on the classpath during AOT processing. This causes issues because devtools uses features incompatible with native images (like class proxies). In contrast, Gradle automatically excludes devtools through its developmentOnly configuration.

Solution:

  • Applied the existing DEVTOOLS_EXCLUDE_FILTER to the classpath used during AOT processing in both ProcessAotMojo and ProcessTestAotMojo
  • This ensures devtools is automatically excluded without requiring any user configuration

Testing:

  • Added integration tests that verify devtools is properly excluded during both main and test AOT processing
  • The tests include projects with devtools as a dependency and confirm that AOT processing completes successfully

Fixes #32853

Previously, spring-boot-devtools was only excluded from native images
built with Gradle but not with Maven. This inconsistency meant that
Maven builds would include devtools in the AOT processing classpath,
causing the native image to fail or include unnecessary code.

This commit applies the existing DEVTOOLS_EXCLUDE_FILTER to the
classpath used during both main and test AOT processing in Maven,
matching the behavior of the Gradle plugin which excludes the
developmentOnly configuration.

The exclusion happens automatically without requiring any user
configuration, ensuring that devtools is properly excluded from
native images while maintaining its functionality during development.

Fixes spring-projectsgh-32853

Signed-off-by: academey <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclude spring-boot-devtools from AOT processing and native images built with Maven
2 participants