Skip to content

fesod-parent declares slf4j-api/lombok as inherited dependencies; move to dependencyManagement #1174

Closed

Description

@pjfanning

While reviewing the staged 2.1.0-incubating RC7 POMs (orgapachefesod-1058), I noticed that the root pom.xml (fesod-parent) declares real <dependencies>, not just <dependencyManagement>. So every child module inherits them, whether it needs them or not.

Current state

Root pom.xml (the <dependencies> block after </dependencyManagement>) declares:

  • org.slf4j:slf4j-api (compile)
  • org.projectlombok:lombok (provided)
  • test-scoped: fastjson2, junit-jupiter, assertj-core, mockito-core, mockito-junit-jupiter, jcl-over-slf4j, log4j-over-slf4j, log4j-to-slf4j, slf4j-simple, jazzer-junit

The published POMs show the effect:

Module Uses SLF4J? Uses Lombok? Published POM declares
fesod-parent n/a n/a slf4j-api (compile), lombok (provided)
fesod-common no yes (1 file) slf4j-api (compile), lombok (provided)
fesod-shaded no (only support/Empty.java plus relocated Spring classes) no slf4j-api (compile), lombok (provided)
fesod-sheet yes (@Slf4j in 25 files) yes slf4j-api (compile), lombok (provided)

So fesod-common and fesod-shaded publish a compile-scope dependency on slf4j-api that they don't use. In practice this is harmless today, because anyone using fesod-sheet needs slf4j-api anyway. But it's inaccurate metadata, and anyone depending on fesod-common or fesod-shaded directly gets an unneeded transitive dependency. mvn dependency:analyze on those modules should flag it as "declared but unused".

Suggested fix

  • Move slf4j-api and lombok into the parent's <dependencyManagement> (versions are likely already managed there). Then declare them explicitly only in the modules that use them:
    • fesod-sheet: slf4j-api, lombok
    • fesod-common: lombok
    • fesod-shaded: neither
  • Optionally do the same for the shared test dependencies. They are test scope so they never leak to users, but declaring them per module keeps each module's POM self-describing. This part is lower priority.
  • Afterwards, confirm with mvn dependency:analyze per module and check the flattened POMs.

Not a release blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions