简体   繁体   English

排除maven中的嵌套传递依赖

[英]Excluding nested transitive dependency in maven

My project depends on jparsec , which depends on cglib , which depends on asm . 我的项目依赖于jparsec ,它取决于cglib ,它依赖于asm My project also directly depends on asm , but a newer version than the one cglib depends on: 我的项目也直接依赖于asm ,但是比cglib更新的版本取决于:

在此输入图像描述

It seems I cannot exclude asm from my jparsec dependency. 似乎我不能从我的jparsec依赖项中排除asm When I attempt to exclude it with Eclipse, it makes no change to my pom. 当我尝试用Eclipse排除它时,它对我的​​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? 这是我唯一的选择,从jparsec排除cglib然后手动添加依赖于cglibasm排除? 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. 我本来期望,如果你把asm之前jparsec在你的POM,将不需要排斥。 The Maven "nearest definition" behaviour would kick in to ensure only 4.1 is used. Maven “最接近的定义”行为将启动以确保仅使用4.1

As per my comment, you have 2 options to solve this issue: 根据我的评论,您有2个选项来解决此问题:

  1. The one that you suggested, eg exclude cglib from jparsec and add cglib with asm excluded. 您建议的那个,例如从jparsec排除cglib并添加带有asm cglib
  2. Locate your asm dependency above the jparsec dependency. jparsec依赖项之上找到您的asm依赖jparsec

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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