DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Understanding Dependencies...Visually!
  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector
  • Fix Circular Dependencies in PostgreSQL Row-Level Security With SECURITY DEFINER Functions
  • Sharing SBOMs Securely Without Giving Too Much Away

Trending

  • No Observability Tool Is the “Best”
  • GraphQL Isn’t Dead Yet, AI Agents Revived It
  • Supply Chain Resilience Analysis With Apache Spark and Neo4j
  • How to Protect Your AI Agents from Prompt Injection Attacks: An Active Defense Approach
  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Gradle Goodness: Exclude Transitive Dependency from All Configurations

Gradle Goodness: Exclude Transitive Dependency from All Configurations

By 
Hubert Klein Ikkink user avatar
Hubert Klein Ikkink
·
Nov. 01, 12 · Interview
Likes (0)
Comment
Save
Tweet
Share
18.4K Views

Join the DZone community and get the full member experience.

Join For Free

We can exclude transitive dependencies easily from specific configurations. To exclude them from all configurations we can use Groovy's spread-dot operator and invoke the exclude() method on each configuration. We can only define the group, module or both as arguments for the exclude() method.

The following part of a build file shows how we can exclude a dependency from all configurations:

...
configurations {
    all*.exclude group: 'xml-apis', module: 'xmlParserAPIs'
}

// Equivalent to:
configurations {
    all.collect { configuration ->
        configuration.exclude group: 'xml-apis', module: 'xmlParserAPIs'
    }
}
...
Transitive dependency Dependency Gradle

Published at DZone with permission of Hubert Klein Ikkink. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Understanding Dependencies...Visually!
  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector
  • Fix Circular Dependencies in PostgreSQL Row-Level Security With SECURITY DEFINER Functions
  • Sharing SBOMs Securely Without Giving Too Much Away

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook