Fork me on GitHub

Hi, I'm in corporate net and I don't have access to clojars or any outside repo. We have a local repository and after configuring ~\.lein\profiles.clj to use these repos, I am able to get stuff working. But this doesn't work for lein templates. example: lein new luminus newproj fails:

Failed to resolve version for luminus:lein-template:jar:RELEASE: could not find metadata luminus:lein-template:maven-metadata.xml in local...
What can I do here? Due to corporate restrictions, I can't manually download jars either so everything sucks.


Templates are maven artifacts, if your maven repo doesn't have them you cannot use them


My maven repo has luminus/lein-template/[multiple versions]


I see inside each version two files: lein-template- lein-template-


But still error occurs when I try to use the template


There are cases where there's jars. Example lein-template-3.10.6.jar lein-template-3.10.6.pom


But there might be a plugin-repositories thing


@UC1DTFY1G Have you tried specifying the version of one that you have in your corporate repo, rather than letting it use RELEASE? I can't remember how you do that with lein new tho' (I haven't used Leiningen for years).


@U04V70XH6 Tried this with specifying --template-version parameter with lein new luminus service --template-version 3.10.6 . However, it looks like lein is trying to download from outside repos only: Could not transfer artifact luminus:lein-template:jar:3.10.6 from/to central (): Could not transfer artifact luminus:lein-template:jar:3.10.6 from/to clojars (): Could not transfer artifact luminus:lein-template:jar:3.10.6 from/to central ( such host is known ( (Errors might have typos as I'm typing manually - can't access slack from corp either)


Looks like lein is disregarding [:user :repositories] entry in ~\.lein\profiles.clj


I'm on Windows if that's of any use


Oh, I added [:user :plugin-repositories] section and added local repos there and that seems to do the trick


What's the rationale for plugin repos to be different from repositories in profiels.clj?


Probably just because plugins have separate dependencies to the regular project dependencies -- so it's makes sense for them to be able to have separate repo specifications.

👍 1
Stef Coetzee11:06:06

Such a nice example that gets right to the point:;cid=C053AK3F9 Made a similar mistake in the map returned by a handler. That is, in the map the handler returns have :body {} as opposed to :body "" . You end up with this error message: java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #'ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentArrayMap Thanks @dpsutton! gratitude

Jim Strieter13:06:14

Sorry if this is dumb. I want to import the class TDistribution from org.apache.commons/commons-math3, so I added this to project.clj:

:dependencies [ ;; other deps
              [org.apache.commons/commons-math3 "3.6.1"]]
At the repl, I type:
(require '[org.apache.commons.math3.distribution.TDistribution :refer :all])
and get this:
Execution error (FileNotFoundException) at clojure-trade-bot-2.core/eval1605 (form-init6615340479110970914.clj:1).
Could not locate org/apache/commons/math3/distribution/TDistribution__init.class, org/apache/commons/math3/distribution/TDistribution.clj or org/apache/commons/math3/distribution/TDistribution.cljc on classpath.
The part that is strange to me is that the REPL completes the names when I press tab. What am I doing wrong?

Alex Miller (Clojure team)13:06:21

You import Java classes

Alex Miller (Clojure team)13:06:46

require is for Clojure namespaces

Jim Strieter13:06:26

I tried this:

(import '[org.apache.... :refer :all])
and I get this:
Syntax error macroexpanding clojure.core/import at (/tmp/form-init6615340479110970914.clj:1:1).
:refer - failed: simple-symbol? at: [:package-list :quoted-spec :spec :classes] spec: :clojure.core.specs.alpha/package-list
[org.apache.commons.math3.distribution.TDistribution :refer :all] - failed: simple-symbol? at: [:class :quoted-spec :spec] spec: :clojure.core.specs.alpha/quotable-import-list
[org.apache.commons.math3.distribution.TDistribution :refer :all] - failed: simple-symbol? at: [:package-list :spec :classes] spec: :clojure.core.specs.alpha/package-list
(quote [org.apache.commons.math3.distribution.TDistribution :refer :all]) - failed: simple-symbol? at: [:class :spec] spec: :clojure.core.specs.alpha/quotable-import-list


import doesn't support modifiers as require.

Jim Strieter13:06:50

Tried this:

(import org.apache....)
(no []'s) and it worked. Thanks!

Jim Strieter13:06:25

Now that I have successfully imported org.apache.commons.math3.distribution.TDistribution ( I am trying to access the cdf method:

(def x (new TDistribution 1))
(.cdf x 42)
and I get this error:
Execution error (IllegalArgumentException) at clojure-trade-bot-2.core/eval1652 (form-init6615340479110970914.clj:1).
No matching method cdf found taking 1 args for class org.apache.commons.math3.distribution.TDistribution
Why can't Clojure find that method? I thought to access a method you do something like this:
(.method-name instance-name &whatever-parameters)


Because you import wrong class Your link goes to smile.stat.distribution.TDistribution

Jim Strieter14:06:31

The import statement is:

(import org.apache.commons.math3.distribution.TDistribution)


But cdf method is in another class

Jim Strieter17:06:42

I feel like an idiot

Jim Strieter17:06:07

I went to documentation for class I did import and magically it works! Thanks @U04V4KLKC 🙂