Skip to content

fix: exclude Spring from resource-server-utils transitive deps#2944

Merged
Naenyn merged 1 commit into
uPortal-Project:masterfrom
bjagg:fix/exclude-spring-from-resource-server-utils
Apr 22, 2026
Merged

fix: exclude Spring from resource-server-utils transitive deps#2944
Naenyn merged 1 commit into
uPortal-Project:masterfrom
bjagg:fix/exclude-spring-from-resource-server-utils

Conversation

@bjagg

@bjagg bjagg commented Apr 22, 2026

Copy link
Copy Markdown
Member

Summary

uPortal explicitly pins springVersion=4.3.30.RELEASE, but resource-server 1.5.x transitively depends on Spring 5.x. Without an exclusion, a build bumping resource-server to 1.5.x ends up with both Spring versions on the classpath; javac resolves org.springframework.web.util.UriUtils against the Spring 5 API where encodePathSegment(String, String) no longer declares throws UnsupportedEncodingException, and the catch clause in Util.encodePathSegment() becomes unreachable:

uPortal-utils-core/src/main/java/org/apereo/portal/utils/jsp/Util.java:143:
  error: exception UnsupportedEncodingException is never thrown in body
  of corresponding try statement

This is the CI failure blocking #2537 (Renovate's resource-server 1.3.1 → 1.5.2 bump).

The fix

Two <dependency>.exclude blocks on the resource-server-api and resource-server-utils declarations in uPortal-utils/uPortal-utils-core/build.gradle, cherry-picked verbatim from the equivalent hunk in @Naenyn's #2915 (where the same exclusion is part of a larger 193-file Bootstrap/jQuery PR):

api("org.jasig.resourceserver:resource-server-api:${resourceServerVersion}") {
    exclude group: 'org.springframework', module: 'spring-jcl'
    exclude group: 'org.slf4j'
}
api("org.jasig.resourceserver:resource-server-utils:${resourceServerVersion}") {
    exclude group: 'org.springframework'
    exclude group: 'org.slf4j'
}
  • Narrower exclusion on resource-server-api (only spring-jcl module + all slf4j) — resource-server-api is a smaller artifact.
  • Broader exclusion on resource-server-utils (all org.springframework + all slf4j) — this is the one that drags in the full Spring 5 web stack.

Landing it independently on master unblocks #2537 without coupling to the Bootstrap/jQuery work in #2915.

Test plan

Validated locally:

  • master + this change @ resourceServerVersion=1.3.1:uPortal-utils:uPortal-utils-core:compileJava BUILD SUCCESSFUL (exclusion is benign on current master)
  • master + this change @ resourceServerVersion=1.5.2 (simulated by editing gradle.properties locally) → :uPortal-utils:uPortal-utils-core:compileJava BUILD SUCCESSFUL (Util.java compile error goes away)

Related PRs — merge order to fully unblock resource-server 1.5.2

  1. This PR → fixes Util.java compile error surfaced by Spring version clash.
  2. Fixes for guava version bump #2943 → fixes ErrorProne CheckReturnValue on LimitingTeeWriter / LimitingTeeOutputStream that surfaces when newer Guava comes along via resource-server 1.5.x.
  3. fix(deps): update resource server to v1.5.2 - autoclosed #2537 (Renovate) → the actual 1.3.1 → 1.5.2 bump; CI goes green once both fixes above have landed.
  4. Bootstrap / jQuery Update & Fluid Infusion Removal #2915 (Bill's Bootstrap/jQuery PR) → rebases master and gets clean CI, leaving only content review.

uPortal pins springVersion=4.3.30.RELEASE explicitly, but resource-server
1.5.x transitively depends on Spring 5.x. Without an exclusion, a build
bumping resource-server to 1.5.x ends up with both Spring versions on
the classpath and javac resolves org.springframework.web.util.UriUtils
against the Spring 5 API — where encodePathSegment(String, String) no
longer declares 'throws UnsupportedEncodingException'. The catch clause
in uPortal-utils-core's Util.encodePathSegment() then becomes unreachable
and compilation fails with:

  Util.java:143: error: exception UnsupportedEncodingException is never
  thrown in body of corresponding try statement

This is exactly the CI failure on uPortal-Project#2537 (Renovate's resource-server
1.3.1 → 1.5.2 bump), and the fix originates from @Naenyn's uPortal-Project#2915 where
this exclusion is part of a larger 193-file PR. Landing it independently
on master unblocks uPortal-Project#2537 and any other branch bumping resource-server,
without coupling to the Bootstrap/jQuery work in uPortal-Project#2915.

Exclusion policy mirrors what uPortal-Project#2915 applies:
  - resource-server-api:  exclude spring-jcl (module-level) and all slf4j
  - resource-server-utils: exclude all of org.springframework and all slf4j

The narrower exclusion on resource-server-api reflects that it's a
smaller artifact; the broader exclusion on resource-server-utils
prevents the full Spring 5 web stack from riding along.

Verified locally:
  - master + this change (resourceServerVersion=1.3.1):
    :uPortal-utils:uPortal-utils-core:compileJava BUILD SUCCESSFUL
  - master + this change + resourceServerVersion=1.5.2 (simulated):
    :uPortal-utils:uPortal-utils-core:compileJava BUILD SUCCESSFUL
    (the Util.java error goes away)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bjagg bjagg self-assigned this Apr 22, 2026
@bjagg bjagg requested a review from Naenyn April 22, 2026 17:29
@Naenyn Naenyn merged commit ce6095b into uPortal-Project:master Apr 22, 2026
5 checks passed
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.

2 participants