Skip to content

Make aopalliance dependency optional - #1543

Merged
shakuzen merged 8 commits into
micrometer-metrics:mainfrom
shakuzen:optional-aopalliance
Sep 3, 2026
Merged

shakuzen merged 8 commits into
micrometer-metrics:mainfrom
shakuzen:optional-aopalliance

Conversation

@shakuzen

@shakuzen shakuzen commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Makes aopalliance an optionalApi dependency in micrometer-tracing/build.gradle rather than mandatory api, preventing split-package errors on the Java module path (JPMS) and non-deterministic classloading conflicts when used with Spring AOP.
  • Excludes internal test modules matching integration-test- from Maven publishing and the BOM while preserving publishing for micrometer-tracing-integration-test.
  • Adds three internal integration test modules under internal/ (build-time only) verifying behavior across classpath/modulepath setups:
    • internal/micrometer-tracing-integration-test-spring-aop-with-aspectj: verifies Spring AOP + AspectJ (@Aspect) proxying using spring-aop's bundled org.aopalliance interfaces without aopalliance:1.0.
    • internal/micrometer-tracing-integration-test-spring-aop-no-aspectj: demonstrates failures and tag extraction limitations when attempting aspect proxying without aspectjweaver.
    • internal/micrometer-tracing-integration-test-jpms: tests JPMS module path resolution and demonstrates split-package failures when transitive aopalliance is present with spring.aop.

Closes #1536

Test plan

  • ./gradlew check passes on all modules.
  • Verified JPMS module path resolution behavior across JDKs in micrometer-tracing-integration-test-jpms.
  • Verified publish and publishToMavenLocal tasks are not added for internal integration test modules.

Make aopalliance an optionalApi dependency in micrometer-tracing to
prevent split-package errors and classpath conflicts in JPMS/modular
environments when used alongside spring-aop.

Add non-published integration test modules covering Spring AOP, AspectJ
standalone, JPMS module path resolution, and non-AspectJ setups.

Closes micrometer-metrics#1536
Different JDK versions may report either org.aopalliance.aop or
org.aopalliance.intercept first when encountering a split package.
Exclude 'integration-test-' projects rather than 'integration-test' to
ensure micrometer-tracing-integration-test continues to be published and
included in the BOM while excluding the newly added build-time test modules.
Comment thread build.gradle Resolved
Move non-published integration test modules under a new 'internal'
directory to distinguish them from published test modules under
'micrometer-tracing-tests'. Add explanatory comments for the
'integration-test-' exclusions in build.gradle and the BOM.
Proper standalone AspectJ (LTW/CTW) integration testing requires
dedicated runtime configuration and constructor enhancements, which is
better scoped in a separate follow-up task.
micrometer-tracing-test and spring-context are not required since the
test only verifies module path resolution with spring-aop and
micrometer-tracing.
@shakuzen
shakuzen marked this pull request as ready for review September 2, 2026 07:17
api libs.aopAlliance

// aspects
optionalApi libs.aopAlliance

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the primary change. Everything else is testing.

@shakuzen

shakuzen commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

I did try to add AspectJ tests without Spring AOP, but I think we need some changes to enable that (e.g. there's no default no-arg constructor on SpanAspect). Some things have aopalliance types while some implementation details only work with AspectJ. I didn't want to try to tackle untangling any of that in this PR but it may be something to follow-up on.

@shakuzen
shakuzen merged commit 997f404 into micrometer-metrics:main Sep 3, 2026
8 checks passed
@shakuzen
shakuzen deleted the optional-aopalliance branch September 3, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transitive aopalliance dependency conflicts with spring-aop

2 participants