Fork me on GitHub
#beginners
<
2018-05-05
>
Ian Fernandez04:05:59

Could not transfer artifact cider:cider-nrepl:jar:0.16.0 from/to clojars (https://repo.clojars.org/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Ian Fernandez04:05:33

I'm having this error when I'm trying to use CIDER Repl on Emacs

Ian Fernandez04:05:42

Anyone knows why?

Ian Fernandez04:05:17

(defproject fun "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "Eclipse Public License"
            :url ""}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [cider/piggieback "0.3.1"]
                 [org.clojure/tools.nrepl "0.2.13"]]
  :plugins [[cider/cider-nrepl "0.16.0"]])

Ian Fernandez04:05:27

my project.clj is like this

seancorfield04:05:03

@simon Have you tried asking in #datomic ?

seancorfield04:05:56

@d.ian.b what does lein version say?

okwori11:05:25

I have now, thanks

seancorfield04:05:42

In a terminal window.

seancorfield04:05:04

It looks like a TLS/SSL error so your Leiningen version might matter.

Ian Fernandez04:05:21

lein --version Could not find artifact cider:cider-nrepl:jar:0.16.0 in central (https://repo1.maven.org/maven2/) Could not transfer artifact cider:cider-nrepl:jar:0.16.0 from/to clojars (https://repo.clojars.org/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Could not transfer artifact cider:cider-nrepl:pom:0.16.0 from/to clojars (https://repo.clojars.org/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target This could be due to a typo in :dependencies, file system permissions, or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable.

seancorfield04:05:13

You'll need to run it outside your project folder.

seancorfield04:05:27

lein version (not lein --version)

seancorfield05:05:20

(although running lein version inside your project folder probably shouldn't try to load the project.clj I'd have thought)

Ian Fernandez05:05:38

╰─➤ lein version 1 ↵ Could not find artifact cider:cider-nrepl:jar:0.16.0 in central (https://repo1.maven.org/maven2/) Could not transfer artifact cider:cider-nrepl:jar:0.16.0 from/to clojars (https://repo.clojars.org/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Could not transfer artifact cider:cider-nrepl:pom:0.16.0 from/to clojars (https://repo.clojars.org/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target This could be due to a typo in :dependencies, file system permissions, or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable.

seancorfield05:05:51

Outside your project folder??

Ian Fernandez05:05:17

Warning: refactor-nrepl requires org.clojure/clojure 1.7.0 or greater. Warning: refactor-nrepl middleware won't be activated due to missing dependencies. Leiningen 2.8.1 on Java 1.8.0_161 GraalVM 1.0.0-rc1

seancorfield05:05:00

Hmm, 2.8.1 is very recent... but the GraalVM? I don't know if Clojure runs on that?

Ian Fernandez05:05:50

My friend @souenzzo is running on GraalVM

seancorfield05:05:57

I think at this point I'd recommend asking in #leiningen -- this looks Leiningen-specific.

Ian Fernandez05:05:14

i think the middleware is the problem

seancorfield05:05:43

I can load cider/cider-nrepl just fine using clj.

seancorfield05:05:54

So the problem is not with the dependency.

seancorfield05:05:59

Not sure what's bringing in pre-1.7 Clojure. That looks odd too.

Ian Fernandez05:05:44

the problem I think it's lein

Ian Fernandez05:05:52

I've tried to rm -rf .lein

Ian Fernandez05:05:59

and start again

Ian Fernandez05:05:36

It was a global profile.clj on there

zaphodious05:05:41

I'd like to flatten a nested map such that the 'path' leading to it is preserved. How would I do this? Example- Given {:a 1 :b {:c 3 :d 4 :e {:f 6 :g 7}}}, I'd like somethink akin to [:a 1] [:b :c 3] [:b :d 4] [:b :e :f 6] etc.

xtreak2909:05:11

Might be helpful . They join the keys with a separator meanwhile you have to collect them in a vector. https://stackoverflow.com/questions/17901933/flattening-a-map-by-join-the-keys

justinlee17:05:59

question about repl-driven development: let’s say I have a file I’m working in that has a bunch of required namespaces and refers symbols from those namespaces. Is it possible to send forms from that file to the repl such that the repl understands all of that already? Or do I have to eval the whole file to do stuff like that?

mfikes18:05:45

@lee.justin.m You can evaluate individual forms that introduce new/updated defs (or derived things like defns)

noisesmith18:05:05

that's an editor integration thing, but I'd be seriously disappointed by any editor that did those things wrong (I know emacs cider, vim fireplace, and intellij cursive all handle it properly)

mfikes18:05:26

And all your editor really needs to do is ensure it does in-ns before evaluating the code it is sending.

justinlee18:05:47

i’m using cursive. basically this arises when i want to experiment with a library like specter or plumatic schema and I’ve referred a bunch of symbols into the environment. then I want to iterate on some little function, but the repl doesn’t seem to understand any of those symbols

noisesmith18:05:23

OK - are you evaluating forms in the file, or typing them into the repl?

noisesmith18:05:13

if the latter, use in-ns (or even ns) - there may be an editor shortcut to make it do that for you based on the file as well

noisesmith18:05:32

the repl tells you what namespace it is in at the prompt, and I wouldn't expect or even want an editor to change how namespace resolution works

mfikes18:05:46

In Cursive it is Tools > REPL > Switch REPL NS to current file

joelsanchez18:05:58

I've always wanted to know - what's the difference between using in-ns and ns to switch to a ns?

sundarj18:05:03

the first thing the ns macro does is generate a call to in-ns

justinlee18:05:13

yea okay this is working as expected. i must have been doing something strange before.

justinlee18:05:30

annoyingly i’m not sure which of the many things i just tried made it work

justinlee18:05:51

but thanks very much for the help

mfikes18:05:30

TL;DR, use in-ns

noisesmith18:05:51

@joelsanchez ns and in-ns both create a namespace if it doesn't exist, but in-ns isn't a macro and does none of the standard initial bindings like refer-clojure

noisesmith18:05:17

(or creating aliases...)

joelsanchez18:05:33

it was easier than I thought, the answer is "don't" 🙂

noisesmith18:05:55

they are identical but for the ' for switching to a namespace that exists

noisesmith18:05:08

(in jvm clojure)

justinlee18:05:32

when i send forms from the current file, the editor should be doing that in the ns of that file. so like when i re-def something by sending the form from the editor, it will happen in that file’s namespace. same with reloading the entire file (right?)

andy.fingerhut18:05:50

So maybe: Use ns for creating a brand new namespace, with all of its import/require/use if you want those things, use in-ns to switch between already-created namespaces?

👍 1
noisesmith18:05:33

if you ever end up in an uninitialized ns like created by an in-ns typo, you can escape by calling (clojure.core/refer-clojure)

💕 2
mfikes18:05:47

@lee.justin.m If you use Cursive's Tools > REPL > Send ... commands, they evaluate that form in the same namespace as the file.

mfikes18:05:42

(The feedback you get is the that the Var printed has the right namespace, even though your REPL may be in a different one.)

👍 1
joelsanchez18:05:47

@noisesmith that trick would've saved me quite a few times 😅

andy.fingerhut18:05:40

Wow, the implementation of in-ns is buried deep in Clojure/Java. Finding the source for it is not a one-step process.

mfikes18:05:18

In Clojure, is it a REPL special?

andy.fingerhut18:05:18

since it is implemented in Java, not Clojure like most other stuff in clojure.core namespace is

justinlee18:05:32

@mfikes thanks: actually reading what ns the var is evaluated in has explained why i was confused. in cursive, hitting the cmd-shift-p hotkey doesn’t send the form in the current namespace. things started to work when i manually did a (in-ns 'whatever)

andy.fingerhut18:05:17

Not terribly important if you just want to use it -- I only looked at it because of the question of exactly what the difference between in-ns and ns is.

mfikes18:05:35

Wow, in Clojure, in-ns truly is a strange beast. In ClojureScript it is a special form only understood (and implemented) by the REPL.

andy.fingerhut18:05:21

In Clojure/Java, the Clojure code implementing clojure.core and other built-in namespaces uses in-ns quite a lot. I have also seen it being used in a few other Clojure libraries in their source files, since it tripped up Eastwood analysis of those projects until Eastwood started behaving more like Clojure/Java did while analyzing such source code.

mfikes18:05:51

Ahh, right, when implementing a namespace spread across multiple files

mfikes18:05:12

Or, when doing something truly funky

andy.fingerhut18:05:35

I consider at least some of the libraries using in-ns to be truly funky, yes 🙂

mfikes18:05:31

On the other hand, in ClojureScript, you can't take the value of in-ns; it really only ephemerally exists for the REPL, which pulls it out of its hat