How do I do exclusions for dependencies that are pulled in by leiningen when writing a plugin?

后端 未结 1 1545
迷失自我
迷失自我 2021-01-14 07:39

I\'m writing a custom plugin for Leiningen that will help in deploying AWS Lambda functions written in Clojure. I\'m using aws-java-sdk-lambda version 1.

相关标签:
1条回答
  • 2021-01-14 08:16

    First question: is this a known issue?

    This is a known issue, and one that many people writing Leiningen plugins face. The root cause is that Leiningen builds an uberjar with all of its dependencies, and those dependencies are not shaded. This means that if there is any collision between Jackson classes, Leiningen's one will always be chosen. What makes this especially devious is that you won't get any warnings about conflicting dependencies, as the JARs don't conflict, but the contents of them do.

    Here's a few examples of this problem: https://github.com/s3-wagon-private/s3-wagon-private/issues/38, https://github.com/technomancy/leiningen/issues/2215.

    Second: Does anyone have any suggestions for working around this problem?

    Issues with Clojure inter-dependency with different major versions of the same library has some suggestions for the general case, although it gets a little trickier when Lein's dependencies are uberjarred.

    I think your best bet at this point would be to shade the Jackson dependency and the AWS SDK.

    Leiningen master no longer depends on Cheshire though, and when 2.8.0 is released you should have less problems.

    0 讨论(0)
提交回复
热议问题