Skip to content

Conversation

@rpalcolea
Copy link
Member

@rpalcolea rpalcolea commented Nov 22, 2025

Adds automatic shadow component detection with an opt-in feature flag for proper Maven publishing when using the Gradle Shadow plugin. This aligns with Shadow plugin best practices for handling shaded/bundled dependencies vs external dependencies.

Current problem

When using the Shadow plugin to create fat JARs, the current implementation uses components.java for publication, which results in:

  • All dependencies (including shaded ones) appearing in the POM
  • Consumers potentially having dependency conflicts with shaded libraries
  • Deviation from Shadow plugin recommended practices
  • While Shadow plugin supports Gradle Module Metadata, our approach for using the plugin DOES NOT

In fact, we have explicit withXml maven manipulations to workaround this issue

Proposed solution

Implemented automatic shadow component detection controlled by feature flag nebula.publishing.features.detectShadowComponent.enabled that:

  • Detects both com.gradleup.shadow and com.github.johnrengelman.shadow plugins
  • Uses components.shadow for publication when flag is enabled
  • Properly handles dependency separation:
    • implementation dependencies (with relocation) → bundled in JAR, excluded from POM
    • shadow configuration dependencies → external dependencies in POM, not bundled

This was done through feature flag because it is a breaking change and we should give folks time to migrate. We can do our diligence with folks using this at Netflix and then eventually remove the feature flag in a major version of the plugin

@rpalcolea rpalcolea merged commit 3bc6820 into main Nov 24, 2025
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.

1 participant