1

lein run results in the following error:

Could not find artifact foo:common:jar:10.11.0 in central (https://repo1.maven.org/maven2/)                                                                                            
Could not find artifact foo:common:jar:10.11.0 in clojars (https://clojars.org/repo/)

However, on my computer, the file ~/.m2/repository/foo/common/10.11.0/common-10.11.0.jar exists. It seems like lein is trying to download the file from central and clojars, even though it already exists on my computer.

This particular jar does not exist in the maven central or clojars, it exists in a private repository, that I only have access to when I'm on a certain network. I'm not on that network right now, so it would really help if lein did not try to download a file that already exists on my computer.

Does anyone know how to fix this?

Update

I got the information that you can run lein in offline mode using lein -o .... This resulted in the following error though: The repository system is offline but the artifact foo:common:jar:10.11.0 is not available in the local repository.

lsund
  • 744
  • 5
  • 16
  • 1
    Do you have just the `jar` file under `~/.m2/repository/foo/common/10.11.0` directory? Or do you have also `common-10.11.0.pom` file? – Piotrek Bzdyl Oct 03 '18 at 18:40

2 Answers2

1

lein is likely checking for updates, which it won't be able to access while you're off that network, as you had diagnosed.
Run lein with its -o option for offline mode, and it should skip the remote repo checks.

John Flinchbaugh
  • 2,338
  • 1
  • 17
  • 20
  • Thanks for the answer. To my surprise though, I get a new error `The repository system is offline but the artifact foo:common:jar:10.11.0 is not available in the local repository.` But as I wrote in my question, the jar exists on my computer. How can I see what paths `lein` checks? – lsund Oct 03 '18 at 17:31
1

The above sounds good. Also see the following, where you may want to bypass the whole maven jar mechanism and put the jar in ./resources (at least temorarily):

leiningen - how to add dependencies for local jars?

Note carefully the required format of the resource strings!

(defproject test-project "0.1.0-SNAPSHOT"
:description "Blah blah blah"
...
:resource-paths ["resources/Siebel.jar" "resources/SiebelJI_enu.jar"])

See also the option for doing a local maven install in another answer in that link:

mvn deploy:deploy-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar -Durl=file:maven_repository
Alan Thompson
  • 29,276
  • 6
  • 41
  • 48