Fork me on GitHub
#polylith
<
2023-07-06
>
Kent Bull04:07:21

Following the Polylith guide precisely I end up with the following error when trying to build:

Unqualified function can't be resolved: uberjar
What does this mean?

seancorfield04:07:48

Can you provide a bit more context? Link to the relevant part of the guide? The command you typed?

Kent Bull04:07:48

Yes, I was working on the https://polylith.gitbook.io/poly/workflow/build section of the guide and I typed the command clojure -T:build uberjar :project command-line

Kent Bull04:07:27

I created what the Polylith guide recommended, the user component, the cli base, and the command-line project.

Kent Bull04:07:36

This was after I pulled the https://github.com/polyfy/polylith/blob/master/examples/doc-example/build.clj and put it into my project root. I did see that it is deprecated.

seancorfield04:07:45

What's your :build alias in deps.edn?

Kent Bull04:07:03

It is

:build {:deps {io.github.seancorfield/build-clj {:git/tag "v0.5.2" :git/sha "8f75b81088b9809ec3cfc34e951036b3975007fd"
                                                             :ns-default build}}}

Kent Bull04:07:43

OMG, I just saw I am missing :paths ["build/resources"]

Kent Bull04:07:50

sorry, I’ll try that and see what happens.

seancorfield04:07:54

And clojure -version ?

Kent Bull04:07:20

That is Clojure CLI version 1.11.1.1347

👍 2
Kent Bull04:07:35

Looks like adding :paths ["build/resources"] didn’t have an effect for me.

seancorfield04:07:04

Your :build alias is not correct

seancorfield04:07:21

ns-default is at the wrong level

Kent Bull04:07:26

just saw that

seancorfield04:07:38

(on my phone - hard to type fancy stuff)

Kent Bull04:07:59

Thanks for responding so late. Interestingly I now get an Execution error:

Execution error (FileNotFoundException) at build/eval230$loading (build.clj:1).
Could not locate clojure/tools/deps__init.class, clojure/tools/deps.clj or clojure/tools/deps.cljc on classpath.

Full report at:
/var/folders/kg/kzwqkdwn55j5ytz7mpbmbbjm0000gn/T/clojure-2144745716307180706.edn

Kent Bull04:07:15

maybe I didn’t install tools.deps correctly

Kent Bull04:07:53

Ok, updating to v0.9.2 and git sha 9c9f078602effe4df2b7b505003596ea1c5de436 did it for me. The Uberjar is built.

Kent Bull04:07:30

Complete :build alias is:

:build {:deps {io.github.seancorfield/build-clj {:git/tag "v0.9.2" :git/sha "9c9f078602effe4df2b7b505003596ea1c5de436"}}
                    :paths ["build/resources"]
                    :ns-default build}
and the :extra-deps entry is:
io.github.seancorfield/build-clj {:git/tag "v0.9.2" :git/sha "9c9f078602effe4df2b7b505003596ea1c5de436"}

seancorfield04:07:10

Yeah, I was looking at the versions -- tools.deps used to be tools.deps.alpha so older deps would bring in the wrong ns

seancorfield04:07:31

Why/where is build-clj in :extra-deps?

seancorfield04:07:06

Oh, for Cursive use?

Kent Bull04:07:12

This message contains interactive elements.

Kent Bull04:07:15

yes for Cursive use

Kent Bull04:07:31

Mine is at

{:aliases  {:dev {:extra-paths ["."
                                ...]
                  :extra-deps {org.clojure/clojure {:mvn/version "1.11.1"}
                               org.clojure/tools.deps {:mvn/version "0.18.1354"}
                               io.github.seancorfield/build-clj {:git/tag "v0.9.2" :git/sha "9c9f078602effe4df2b7b505003596ea1c5de436"}}}

Kent Bull04:07:46

Oh, I updated my tools.deps.alpha to a more recent version. That was my problem.

Kent Bull04:07:58

I changed from tools.deps.alpha to tools.deps.

seancorfield04:07:09

Yup, as I noted above 🙂

seancorfield04:07:27

The upcoming version of Cursive should involve less workarounds for Polylith.

seancorfield04:07:59

(I have never used Cursive -- I can't stand IntelliJ! -- so I don't have to deal with any of these workarounds)

Kent Bull04:07:52

Ah, I see. I did see you using VSCode in your video that inspired me to use Polylith. I figured I’d give Cursive a try so I can see if I like it. If I could get a similar enough flow working in Emacs I’d switch back. VSCode looks like a great option as well.

Kent Bull04:07:09

Thanks again for the assistance tonight.

seancorfield04:07:19

I love that VS Code is hackable via cljs and Joyride 🙂

seancorfield04:07:32

(I'm an ex-Emacs person)

😆 2
Kent Bull04:07:16

Hard to catch up to all those Microsoft $$$

seancorfield04:07:20

Glad you got things working... the Polylith guide needs some updates on those versions, it seems? I really want to get it all updated to not use my build-clj library at all but that's a bunch of work...

Kent Bull04:07:09

Yeah, I’m sure the guide would have worked perfectly as-is had I not manually updated the tools.deps.alpha to tools.deps . Updating to the latest versions there worked for me eventually.

seancorfield04:07:25

I don't have edit permissions on the poly book, only the high-level Polylith book, but I've left comments about updating versions.

Kent Bull04:07:55

Great, where do I go to thumbs it up?

seancorfield04:07:05

(Joakim will probably give me edit permissions and let me just fix it directly 🙂 )

2
seancorfield04:07:26

I don't think comments are visible to folks without a GitBook account?

seancorfield04:07:32

The downloaded build.clj seems to reference tools.deps, not the alpha version -- what are you referring to in "manually updated the tools.deps.alpha to tools.deps"?

Kent Bull04:07:10

I mean that I changed the ./deps.edn file that was auto generated by poly create workspace name:example top-ns:se.example branch:master :commit The generated project uses an outdated tools.deps.alpha dependency in the ./deps.edn file.

seancorfield04:07:44

Oh... yeah, that dep has never been needed! No idea why the generated project even includes it.

seancorfield04:07:14

What version of the poly tool are you using BTW?

Kent Bull04:07:46

0.2.17-alpha (2022-12-09)

seancorfield04:07:52

(I use a :poly alias and always work from the latest master SHA version -- currently 0.2.18-issue309-05 (2023-06-20) right now)

Kent Bull04:07:32

That’s cool, do you just put the latest :sha argument in the :poly alias in ./deps.edn?

seancorfield04:07:35

Yeah. I used to have it in my dot-clojure deps.edn file but I switched to the installed tools version ages ago (although I have not kept that up to date because I rarely use poly outside an existing Polylith project.

seancorfield04:07:25

Our Polylith stuff in deps.edn at work:

:poly-test-jvm-opts ["--enable-preview"
                       "-client"
                       "-Dclojure.core.async.go-checking=true"
                       "-Dclojure.spec.check-asserts=true"
                       "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
                       "-Djdk.httpclient.allowRestrictedHeaders=host"
                       "-Dlog4j2.configurationFile=/var/www/worldsingles/development/resources/log4j2-silent.properties"
                       "-Dlog4j2.formatMsgNoLookups=true"
                       "-Dlogged-future=synchronous"
                       "-Dws.pubsub.buffer-size=10000"
                       "-XX:-OmitStackTraceInFastThrow"
                       "-XX:+TieredCompilation"
                       "-XX:TieredStopAtLevel=1"]
  :poly {; for our development/logging operations:
         :jvm-opts [;; for poly itself:
                    "-client"
                    "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
                    "-Dlog4j2.formatMsgNoLookups=true"
                    "-Xmx256m"
                    "-XX:-OmitStackTraceInFastThrow"
                    "-XX:+TieredCompilation"
                    "-XX:TieredStopAtLevel=1"
                    ;; for the subprocess that poly test invokes:
                    "-Dpoly.test.jvm.opts=:poly-test-jvm-opts"]
         :extra-deps {io.github.polyfy/polylith
                      {#_#_:git/tag "v0.2.17-alpha" #_#_:git/sha "a1581cc"
                       ;; latest master with unnecessary dependency check:
                       :sha "1209a81e6b8f70987050d65d106e99d1a902969a"
                       :deps/root "projects/poly"}
                      io.github.seancorfield/polylith-external-test-runner
                      {:git/tag "v0.2.0" :git/sha "f208856"
                       :deps/root "projects/runner"}}
         :main-opts ["-m" "polylith.clj.core.poly-cli.core"]}

seancorfield04:07:35

And the start of our workspace.edn (which specifies the external test runner etc):

{:vcs {:name "git" :auto-add false}
 :top-namespace "ws"
 :interface-ns "interface"
 :default-profile-name "default"
 :compact-views #{"deps" "libs"}
 :tag-patterns {;; we tag each QA deployment with build-
                :release "build-[0-9][0-9][0-9][0-9]-*"
                :stable  "stable-*"}
 :test {:create-test-runner [org.corfield.external-test-runner.interface/create]}

Kent Bull04:07:03

That’s helpful. I’ll give it a deeper look tomorrow. I better bounce for tonight. My brain is turning off…

Kent Bull04:07:09

Thanks again!

tengstrand04:07:02

This message contains interactive elements.

seancorfield04:07:05

I get an Edit button on the Polylith book but not on the poly book.

seancorfield05:07:08

Yup, got it now! Thanks!

👍 2
Stefan12:07:23

Hi, I have a question about a warning from polylith. The warning is:

Warning 206: Unreadable namespace in development: /[...]/development/src/data_readers.clj
The contents of that file:
{tap> user/tap*>}
This allows us to put #tap> basically anywhere in our source code to tap the outcome of the following form and return its return value. Super convenient 🙂 I don't quite understand what's causing the Polylith warning. Do you have any idea? Thanks!

Stefan12:07:55

For completeness, this is the user/tap*> definition:

(ns user)

(defn tap*>
  "Implementation of data reader `#tap>` that returns the
   value of what is being tapped, so that you can just put
   it in front of any sepxr.

   This is used as a data reader (see `data_readers.clj`),
   meaning that it is ran read-time. In other words, it is
   in fact a macro, even though it looks like a normal
   function."
  [body]
  `(let [result# (do ~body)]
     (tap> result#)
     result#))

Stefan13:07:11

Thanks @U2BDZ9JG3! Is this really the same problem though? I'm NOT having the non-top-namespace warning, but "unreadable namespace"...

Stefan13:07:22

This suggests some sort of parse error or something?

furkan3ayraktar13:07:40

You can try ignoring that file:

{ ...
  :projects 
   {"development" 
    {:alias "dev" 
     :ignore-files ["data_readers.clj"]}}

...}

Stefan13:07:51

Yep that works, thank you!!

furkan3ayraktar13:07:25

Hmm, I think if you add (ns data-readers) on top of your data_readers.clj file, you should not need to add the ignore-files .

Stefan13:07:05

When I do that I get clojure.lang.ExceptionInfo: Not a valid data-reader map when jacking in. But that's OK, ignoring it is fine for me.

furkan3ayraktar13:07:14

I see. Maybe Polylith should not check anything with data_readers files. @U1G0HH87L

tengstrand14:07:33

Sounds like the way to go Furkan! I will create an issue when I’m near a keyboard.

🙌 1
tengstrand17:11:08

Issue 316 has been fixed and merged to master @UGNFXV1FA. Now you should be able to remove :ignore-files .

❤️ 1
Stefan12:11:16

Thanks for the heads-up, much appreciated!

👍 1
Stefan14:07:15

Something else: I just switched to the main branch of poly, and noticed some super-nice additions! 🎉 One of those is the ability to detect "unnecessary components" in projects. Great feature! I think I found an omission though. One of my poly projects needs a component dependency only for the test setup (as defined in workspace.edn using :setup-fn. Poly reports the component as unnecessary, but it's not. So maybe the omission is that it should also take the setup-fn namespaces into account?

tengstrand16:07:45

You can list necessary components using the :necessary keyword and a vector with namespaces as value in :projects in workspace.edn, to get rid of that warning. I’m away from keyboard right now, but will give a better answer when back.

tengstrand16:07:24

Type ’help check’ to read about how to get rid of that warning.

Stefan16:07:56

Thanks @U1G0HH87L That seems clear enough for me to fix it myself, no need for you to spend more time on this 👍 I’m AFK myself right now, I’ll try later.

👍 1