Skip to content

Exclude logback-classic from generate-configprops plugin dependency - #686

Merged
ryanjbaxter merged 1 commit into
5.0.xfrom
fix/generate-configprops-logback-conflict
Sep 17, 2026
Merged

ryanjbaxter merged 1 commit into
5.0.xfrom
fix/generate-configprops-logback-conflict

Conversation

@ryanjbaxter

@ryanjbaxter ryanjbaxter commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes intermittent/reproducible failures of the generate-configprops exec-maven-plugin execution in downstream projects (e.g. spring-cloud-config's 5.0.x CI: https://github.com/spring-cloud/spring-cloud-config/actions/runs/35267039454/job/105356701618):

java.lang.NoSuchMethodError: 'java.lang.ClassLoader ch.qos.logback.core.util.Loader.systemClassloaderIfNull(java.lang.ClassLoader)'

spring-cloud-build-docs is consumed by this execution via the jar-with-dependencies classifier — a shaded uber jar that already bundles its own, self-consistent logback-classic/logback-core pair. However, exec-maven-plugin's includePluginDependencies classpath merge also separately resolves the dependency's own unversioned logback-classic (which lands on an old, incompatible version), adding a second, conflicting copy of these classes to the classpath. Which copy actually gets loaded for which class depends on classpath ordering, which isn't guaranteed stable across builds — hence the intermittent nature of the failure.

Verified by disassembling the actual jars from a failing CI run: the uber jar's bundled Loader class has systemClassloaderIfNull, but the separately-resolved standalone logback-core (an old version) does not, while the separately-resolved logback-classic's ContextInitializer doesn't call it at all — confirming two mismatched copies were present on the classpath.

Fix

Exclude ch.qos.logback:logback-classic (which transitively pulls logback-core) from the spring-cloud-build-docs plugin dependency declaration in the generate-configprops execution, so the classpath relies solely on the matched pair already bundled in the uber jar.

Test plan

  • CI passes for this PR
  • spring-cloud-config's 5.0.x CI job (which triggered this investigation) is rerun against the updated spring-cloud-build snapshot and passes the generate-configprops step consistently

spring-cloud-build-docs is consumed via the jar-with-dependencies
classifier, which already bundles a matched logback-classic/
logback-core pair. exec-maven-plugin's includePluginDependencies
classpath merge also separately resolves the dependency's own
unversioned logback-classic, landing an old, incompatible
logback-classic/logback-core split across the uber jar and the
separately-resolved thin jar. Depending on classpath ordering this
intermittently fails generate-configprops with:

  java.lang.NoSuchMethodError: 'java.lang.ClassLoader
  ch.qos.logback.core.util.Loader.systemClassloaderIfNull(java.lang.ClassLoader)'

Excluding logback-classic (and transitively logback-core) forces the
classpath to rely solely on the bundled, self-consistent pair.
@ryanjbaxter
ryanjbaxter force-pushed the fix/generate-configprops-logback-conflict branch from 10dfe2c to 9ee76b6 Compare September 17, 2026 20:25
ryanjbaxter added a commit that referenced this pull request Sep 17, 2026
spring-cloud-build-docs is consumed via the jar-with-dependencies
classifier, which already bundles a matched logback-classic/
logback-core pair. exec-maven-plugin's includePluginDependencies
classpath merge also separately resolves the dependency's own
unversioned logback-classic, landing an old, incompatible
logback-classic/logback-core split across the uber jar and the
separately-resolved thin jar. Depending on classpath ordering this
can intermittently fail generate-configprops with:

  java.lang.NoSuchMethodError: 'java.lang.ClassLoader
  ch.qos.logback.core.util.Loader.systemClassloaderIfNull(java.lang.ClassLoader)'

Excluding logback-classic (and transitively logback-core) forces the
classpath to rely solely on the bundled, self-consistent pair. Same
fix as #686 on 5.0.x, applied here preemptively since main has the
identical fragile setup.
@ryanjbaxter
ryanjbaxter merged commit 979e7b5 into 5.0.x Sep 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants