Leiningen error: Could not transfer artifact no supported algorithms found

1.3k views Asked by At

I am trying to use a jar file in my Clojure app. I have never done this before, but reading various articles on the web, I started by doing this, inside of my project:

mkdir maven_repository

mvn install:install-file -DgroupId=local -DartifactId=nlp -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=original-nlp-1.0-SNAPSHOT.jar  -DlocalRepositoryPath=maven_repository 

And in my project.clj file I have:

 [local/nlp "1.0-SNAPSHOT"]

but when I run:

lein clean
lein uberjar

I get this error:

Could not transfer artifact local:nlp:pom:1.0-SNAPSHOT from/to local (/salesslick/maven_repository/): no supported algorithms found

I've checked things like this:

lein uberjar

(Retrieving local/nlp/1.0-SNAPSHOT/nlp-1.0-SNAPSHOT.pom from local)
(Could not transfer artifact local:nlp:pom:1.0-SNAPSHOT from/to local   (file:/Users/charlottesville/projects/ollio/salesslick/maven_repository/): no supported algorithms found)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Uberjar aborting because jar failed: Could not resolve dependencies

cat local/nlp/1.0-SNAPSHOT/nlp-1.0-SNAPSHOT.pom

cat maven_repository/local/nlp/1.0-SNAPSHOT/nlp-1.0-SNAPSHOT.pom

<?xml version="1.0" encoding="UTF-8"?>
  <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>local</groupId>
  <artifactId>nlp</artifactId>
  <version>1.0-SNAPSHOT</version>
  <description>POM was created from install:install-file</description>
</project>

lein --version
Leiningen 2.4.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM

What am I doing wrong?

2

There are 2 answers

4
Unknown On BEST ANSWER

Joining really on time...

I had the same issue and the solution seems to be to actually use maven deploy instead of install.

So the command will look like this:

mvn deploy:deploy-file -DgroupId=local -DartifactId=bar \
  -Dversion=1.0.0 -Dpackaging=jar -Dfile=bar.jar \
  -Durl=file:repo

You also of course need

:repositories {"project" "file:repo"}

in your defproject and

[local/bar "1.0.0"]

in your dependencies. Note that in -Durl=file:repo file is needed (kind of obvious though) and repo is a folder in the root folder of your repository.

Another way to achieve the same result using purely Leiningen and forgetting about any mvn commands would be to use

lein deploy project local/bar 1.0.0 bar.jar

instead of the mvn command shown above. This can save you the trouble of actually installing maven on a docker container for example (which can also be tricky depending on the container OS).

All this info is taken from here.

2
Tim X On

I just had to solve this problem myself. After a bit of googling, I got more confused because there was just too many different solutions. In the end, it turned out to be REALLY easy.

Basically, I just used the lein-localrepo plugin. 

1. Add the plugin to my plugins section of profiles.clj i.e.


    {:user 
      {:plugins [[lein-ancient "0.6.10"]
                 [jonase/eastwood "0.2.3"]
                 [lein-kibit "0.1.3"]
                 [lein-bikeshed "0.4.1"]
                 [lein-localrepo "0.5.3"]]
      :dependencies [[slamhound "1.5.5"]]
       :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}
  1. Ran lein localrepo coords to get the artifact/id stuff

    lein localrepo coords jcifs-1.3.18.jar

  2. Add the jar to my .m2 repo

    lein localrepo install jcifs-1.3.18.jar jcifs/jcifs 1.3.18

  3. Added the dependency to my project.clj

  4. ran lein deps to make sure all looked good

  5. In my clj file, added the necessary :import line in the ns header

Worked perfectly!

This does mean that if I want to build this on another machine, the jar file has to be added to the .m2 on that system. Theoretically, you could specify a project specific repository directory and then bundle it all up, but I prefer to keep or my jars in one place.