Skip to content

runtimeClasspath and testRuntimeClasspath exclusions are not applied to processAotClasspath and processTestAotClasspath - #51383

Open
gregjotau wants to merge 1 commit into
spring-projects:mainfrom
gregjotau:aot-runtime-classpath-exclusions
Open

runtimeClasspath and testRuntimeClasspath exclusions are not applied to processAotClasspath and processTestAotClasspath#51383
gregjotau wants to merge 1 commit into
spring-projects:mainfrom
gregjotau:aot-runtime-classpath-exclusions

Conversation

@gregjotau

Copy link
Copy Markdown

processAotClasspath and processTestAotClasspath are assembled from the parent configurations of their respective runtime classpaths so that development-only dependencies can be omitted. As a result, exclusion rules declared directly on runtimeClasspath or testRuntimeClasspath are currently lost.

This can make AOT processing evaluate classpath conditions differently from the packaged application. For example, excluding aspectjweaver from runtimeClasspath still exposes it to AOT processing, which selects AnnotationAwareAspectJAutoProxyCreator; the AOT-processed application then fails at runtime because AspectJ is correctly absent.

Copy the direct runtime classpath exclusion rules immediately before resolving the AOT processing classpath. Doing this lazily honors exclusions configured after the AOT plugin is applied. Integration tests cover both application and test AOT classpaths on the supported Gradle versions.

Verified with:

./gradlew :build-plugin:spring-boot-gradle-plugin:check

Signed-off-by: GT <gregjotau@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 15, 2026
@wilkinsona wilkinsona changed the title Honor runtime classpath exclusions during AOT processing runtimeClasspath and testRuntimeClasspath exclusions are not applied to processAotClasspath and processTestAotClasspath Aug 26, 2026
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 26, 2026
@wilkinsona wilkinsona added this to the 4.0.x milestone Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants