Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@plexus

Description

@plexus

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions