Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

enter image description here

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.

like image 512
Kent Boogaart Avatar asked Dec 13 '12 15:12

Kent Boogaart


2 Answers

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.

like image 179
Duncan Jones Avatar answered Oct 15 '22 16:10

Duncan Jones


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

  1. The one that you suggested, e.g. exclude cglib from jparsec and add cglib with asm excluded.
  2. Locate your asm dependency above the jparsec dependency.
like image 31
Andrew Logvinov Avatar answered Oct 15 '22 16:10

Andrew Logvinov