简体   繁体   中英

Excluding nested transitive dependency in maven

My project depends on jparsec , which depends on cglib , which depends on asm . My project also directly depends on asm , but a newer version than the one cglib depends on:

在此输入图像描述

It seems I cannot exclude asm from my jparsec dependency. When I attempt to exclude it with Eclipse, it makes no change to my pom. If I manually exlude it, it has no effect.

Is my only option here to exclude cglib from jparsec and then to manually add a dependency on cglib with asm excluded? This seems a bit convoluted to me, but it does work.

I would have expected that if you put asm before jparsec in your POM, no exclusion would be required. The Maven "nearest definition" behaviour would kick in to ensure only 4.1 is used.

As per my comment, you have 2 options to solve this issue:

  1. The one that you suggested, eg exclude cglib from jparsec and add cglib with asm excluded.
  2. Locate your asm dependency above the jparsec dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM