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

local_repo not being used for resolving plugin dependencies #1140

Closed
kornysietsma opened this issue Apr 10, 2013 · 9 comments
Closed

local_repo not being used for resolving plugin dependencies #1140

kornysietsma opened this issue Apr 10, 2013 · 9 comments

Comments

@kornysietsma
Copy link

(Note: this is on Windows, not sure if it's platform specific)

I've been trying to use lein-kibit on a project that has a :local_repo setting (as ~/.m2 is on a network drive so slow).

If I add [lein-kibit "0.0.8"] to :plugins and run "lein kibit", the "jonase/kibit" and "lein-kibit" jars are downloaded to my local repo, but then I get the error:

Could not find artifact jonase:kibit:jar:0.0.8
This could be due to a typo in :dependencies or network issues.

If I remove the :local_repo setting, the jars are downloaded to ~/.m2 and then "lein kibit" works.

If I restore the original :local_repo value, "lein kibit" continues to work - it seems the jar is being accessed from ~/.m2/repository despite my :local_repo setting. If I remove the ~/m2/repository directory, "lein kibit" breaks again.

@technomancy
Copy link
Owner

Are you actually using :local_repo with an underscore, or is that a typo? If you're using it with an underscore Leiningen should just ignore it, so it's surprising that it actually makes a difference. However, I can't reproduce it by using a dash.

@kornysietsma
Copy link
Author

Sorry, yes, ":local-repo" not ":local_repo" - see https://gist.github.com/kornysietsma/5368225 for the code
I've now reproduced this on Windows and OSX:

  • make sure you have no kibit jars in your ~/.m2 repository:
  • rm -rf ~/.m2/repository/jonase/kibit
  • lein kibit produces:
    Could not find artifact jonase:kibit:jar:0.0.8 This could be due to a typo in :dependencies or network issues.

If you comment out the ":local-repo" line, then lein kibit works.

If you then restore the ":local-repo" line, lein kibit will continue to work, but it is using the kibit jar from ~/.m2/repository/jonase/kibit not from the "local-m2" directory.

(tested with Leiningen 2.1.2 on Java 1.6.0_37)

@technomancy
Copy link
Owner

Is anyone else able to reproduce this?

@ghost
Copy link

ghost commented May 13, 2013

@kornysietsma have you tested this with jdk7 (just not 6) because I think I've seen this(or similar) happen in ccw and was wondering if it's related (in ccw is solvable by making sure eclipse runs jdk7 and not 6)

@pbalduino
Copy link

I'm having the same problem. I tried:
c:\java\maven-repository
c:/java/maven-repository
/java/maven-repository

And it didn't work either.

@technomancy
Copy link
Owner

I think this is fixed on master; feel free to reopen with repro steps if you're still seeing it.

@JakePi3
Copy link

JakePi3 commented Oct 7, 2015

I am seeing this when :local-repo is specified in any profile (other than at the top level). All plugins are resolved against and downloaded to ~/.m2/repository

Issue goes away if :local-repo is specified at the top level in project.clj, or if no plugins are specified at project level.

Workaround: Move all plugins into the :dev profile inside the project.clj, then the profiles.clj :local-repo setting will be correctly picked up.

Steps to reproduce:

  1. Have a top-level :plugins directive in the project.clj
  2. Do not have a top-level :local-repo directive (put it in a profile)

Outcome: Plugins will be resolved against default m2 repo location while depdendencies of the project will correctly use the :local-repo

Summary: Resolution of plugins declared at the top level only obey :local-repo directives also declared at the top level.

@tvaughan
Copy link

tvaughan commented Apr 4, 2016

I've just been bit by this, on Linux. I can't get this to work other then by deleting :local-repo from project.clj. Other plugins work fine, but not kibit. Could maybe possibly be related to #2111. However, I'm using a much different setup than the one I mention in that issue. This is what I have now:

(defproject villarrica-backend "0.1.0-SNAPSHOT"
  :description "The new new Content Manager backend."
  :url "https://github.com/lynxtp/villarrica-backend"
  :dependencies [[com.datomic/datomic-pro "0.9.5350" :exclusions [commons-codec]]
                 [compojure "1.5.0"]
                 [org.clojure/clojure "1.8.0"]
                 [org.clojure/data.json "0.2.6"]
                 [ring-middleware-format "0.7.0"]
                 [ring/ring-core "1.4.0"]
                 [ring/ring-defaults "0.2.0"]]
  :repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"
                                   :password :env/datomic_repo_password
                                   :username :env/datomic_repo_username}}
  :local-repo "/srv/lein/repo"
  :target-path "/var/cache/target/%s"
  :clean-targets ^{:protect false} [:target-path ".coverage"]
  :profiles {:ancient
             {:plugins [[lein-ancient "0.6.10"]]}
             :cloverage
             {:plugins [[lein-cloverage "1.0.6"]]}
             :cider
             {:plugins [[cider/cider-nrepl "0.11.0"]]}
             :dev
             {:dependencies [[com.cognitect/transit-clj "0.8.285"]
                             [org.clojure/test.check "0.9.0"]
                             [ring/ring-mock "0.3.0"]]}
             :eastwood
             {:plugins [[jonase/eastwood "0.2.3"]]}
             :environ
             {:plugins [[lein-environ "1.0.2"]]}
             :kibit
             {:plugins [[lein-kibit "0.1.2"]]}
             :prone
             {:dependencies [[prone "1.1.1"]]
              :ring {:stacktrace-middleware prone.middleware/wrap-exceptions}}
             :ring
             {:plugins [[lein-ring "0.9.7"]]
              :ring {:handler villarrica.backend.ring/api}}
             :squiggly
             {:dependencies [[acyclic/squiggly-clojure "0.1.5" :exclusions [org.clojure/tools.cli]]
                             ^:replace [org.clojure/tools.nrepl "0.2.12"]]
              :env {:squiggly {:checkers [:eastwood :kibit]}}}
             :ultra
             {:plugins [[venantius/ultra "0.4.1"]]}
             :uberjar
             {:aot :all}}
  :aliases {"coverage"
            ["with-profile" "+cloverage,+ultra" "do" "clean," "cloverage" "-o" ".coverage"]
            "eastwood"
            ["with-profile" "+eastwood" "eastwood"]
            "emacs"
            ["with-profile" "+cider,+eastwood,+environ,+kibit,+squiggly,+ultra" "repl"]
            "kibit"
            ["with-profile" "+kibit" "kibit" "src" "test"]
            "repl"
            ["with-profile" "+ultra" "repl"]
            "serve"
            ["with-profile" "+ring" "ring" "server-headless" ~(System/getenv "VILLARRICA_BACKEND_PORT")]
            "test"
            ["with-profile" "+ultra" "test"]
            "update-dependencies"
            ["with-profile" "+ancient,+cloverage,+cider,+eastwood,+environ,+kibit,+prone,+ring,+squiggly,+ultra" "ancient" "upgrade" ":all" ":check-clojure"]})

What's funny is that kibit works in the emacs profile (via squiggly-clojure) but not in the kibit profile alone.

@overthink
Copy link

overthink commented Jan 27, 2017

I believe I have a very simple repro for this with leiningen 2.7.1: https://github.com/overthink/lein-local-repo-issue

It looks like lein will happily download dependencies into the local repo (i.e. when resolving deps), but when the plugin (kibit) is actually run lein doesn't look in the local repo. My current "understanding" anyway.

UPDATE: This turns out to be kibit-specific. I've submitted a PR to lein-kibit that fixes this in some cases: jonase/lein-kibit#10

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

6 participants