Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocated dependencies don't show up in lein deps :tree #2745

Open
4 tasks done
plexus opened this issue May 12, 2021 · 1 comment
Open
4 tasks done

Relocated dependencies don't show up in lein deps :tree #2745

plexus opened this issue May 12, 2021 · 1 comment

Comments

@plexus
Copy link

plexus commented May 12, 2021

Initial debugging steps

  • Updating to using the latest released version of Leiningen (lein upgrade).
  • Moving your ~/.lein/profiles.clj (if present) out of the way. This contains third-party dependencies and plugins that can cause problems inside Leiningen.
  • Updating any old versions of plugins in your project.clj, especially if the problem is with a plugin not working. Old versions of plugins like nREPL and CIDER (as well as others) can cause problems with newer versions of Leiningen.
  • (If you are using Java 9 or newer), updating your dependencies to their most recent versions. Recent JDK's have introduced changes which can break some Clojure libraries.

Describe the bug

Maven has a feature called "relocation" where a pom for a given artifact can signal that this artifact has relocated to a different groupId. This acts as kind of redirect, for instance if you depend on org.hibernate/hibernate-validator, then this will actually end up using org.hibernate.validator/hibernate-validator, because of this stanza in the pom.xml:

    <distributionManagement>
        <relocation>
            <groupId>org.hibernate.validator</groupId>
        </relocation>
    </distributionManagement>

This in itself works fine, the new artifact will be downloaded and added to the classpath, but it will not get listed when calling lein deps :tree.

To Reproduce
Steps to reproduce the behavior:

project.clj:

(defproject relocation-test "0.1.0-SNAPSHOT"
  :dependencies [[org.hibernate/hibernate-validator "7.0.1.Final"]])

and invoke lein deps :tree

result:

Actual behavior

$ lein deps :tree
 [clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
 [nrepl "0.8.3" :exclusions [[org.clojure/clojure]]]

Side note, I have verified with clojure.java.classpath that hibernate-validator is indeed on the classpath:

/home/arne/.m2/repository/org/hibernate/validator/hibernate-validator/7.0.1.Final/hibernate-validator-7.0
.1.Final.jar

Expected behavior

$ lein deps :tree
 [clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
 [nrepl "0.8.3" :exclusions [[org.clojure/clojure]]]
 [org.hibernate.validator/hibernate-validator "7.0.1.Final"]

Environment

  • Leiningen Version: 2.9.6
  • Leiningen installation method: manual
  • JDK Version: openjdk version "11.0.7" 2020-04-14
  • OS: Ubuntu 21.04

Additional context

This is prompted by clojars/clojars-web#801 and lambdaisland/open-source#2. Due to the new Clojars policies around group id naming there is some interest in Maven's relocation support, and we are looking at what the support is across tools.

@technomancy
Copy link
Owner

Happy to take a patch for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants