This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-22
Channels
- # adventofcode (21)
- # announcements (2)
- # babashka (35)
- # beginners (45)
- # calva (22)
- # cider (28)
- # clj-kondo (39)
- # clj-on-windows (69)
- # clojure (28)
- # clojure-europe (15)
- # clojure-nl (7)
- # clojure-uk (24)
- # clojurescript (95)
- # cursive (9)
- # data-science (3)
- # datalevin (2)
- # emacs (11)
- # etaoin (9)
- # fulcro (1)
- # graphql (4)
- # jobs (8)
- # lsp (66)
- # malli (10)
- # missionary (3)
- # pathom (4)
- # polylith (67)
- # releases (3)
- # reveal (2)
- # shadow-cljs (53)
- # spacemacs (2)
- # specter (1)
- # sql (1)
- # tools-deps (6)
- # vim (4)
- # xtdb (16)
Hi all. So I am trying to start a new project and I am just using a simple log component to test. I tried running this in cursive, but somehow it always end up telling me that my components/log/interface.clj is not a Source Root.
It just 'poly create workspace ' add the log component from 'realworld' and update top-level deps.edn to include extra-paths:
"components/log/src"
"components/log/resources"
Then I load the project into Cursive and it fails to resolve. Is there some kind of additional thing that needs to be done?Hi @U0JE93A5V! We like to use threads as much as possible in the #polylith channel. Can you share your deps.edn
and workspace.edn
files so we can take a look?
If you're using :extra-paths
, I think Cursive should be happy -- but it doesn't understand local roots in :extra-deps
, unfortunately, which is the recommended way to set things up.
I suspect you may have omitted the step in Cursive where you tell it to use the :dev
alias when you set up the project?
The whole deps.edn
file.
Looks right. Did you see my comment about telling Cursive about the :dev
alias?
├── bases ├── components │ └── log │ ├── deps.edn │ ├── resources │ │ └── log │ ├── src │ │ └── ch │ │ └── wiki │ │ └── historyatlas │ │ └── log │ │ ├── config.clj │ │ ├── core.clj │ │ └── interface.clj │ └── test │ └── ch │ └── wiki │ └── historyatlas │ └── log │ └── interface_test.clj ├── deps.edn ├── development │ └── src ├── history-atlas.iml ├── logo.png ├── projects ├── readme.md └── workspace.edn
Otherwise, it won't know to read those :extra-paths
and :extra-deps
(and don't forget to add "components/log/test"
to the :extra-paths
under the :test
alias -- and you'll also need a SHA in that :sha ""
line if you want to use clojure -M:poly
as opposed to the O/S-installed poly
command)
Unrleated questions, why not make the poly tool into a binary with graalvm to avoid startup?
You have test/ch/wiki/historyatlas/log/interface_test.clj
already.
SHA is from GitHub
What is interesting, I tested deleting everything from example app that wasn't needed and I also delete the .idea folder. When I reopned the project I have the same problem there.
88c1f4cca32d8a30a2ef298b1d96880c6417faf9
is the SHA for alpha 13, 8cd415f0da54e28f117c74848c32f91d23c805d4
is what is current on master for https://github.com/polyfy/polylith
Sounds like you're going to need help from someone who uses Cursive, sorry. Not sure when they'll be online but they're mostly in a different TZ...
(although it's 2:30 am for you, right?)
Heh, I'm on vacation now until I go back on Monday.
Btw, I have been using Clojure since Clojure 1 days and you have done so many great projects. Thanks for that.
Do you use Cursive because you also do Java or some other JVM language?
I've tried several different versions of IntelliJ over the years and I've never liked it. I used Eclipse for years and preferred it to IntelliJ but the Clojure extension for Eclipse stopped being maintained years ago, so I went through a lot of editors before ending up on Atom for several years and then moved to VS Code (last year I think?).
Yes, we use it for work for Java. I used Emacs back in the early days but it drove me crazy and I have never been an emacs person.
I figured out at least one thing, nrepl is required, just using 'clojure.main' doesn't work.
But that intellj still doesn't allow me to do that, only works with the example project.
I use VS Code on macOS and Windows. For the latter, I use WSL2 with Ubuntu and run all my Clojure stuff runs on Ubuntu, with the remote-wsl2 extension in VS Code to make it feel like a native experience. But, yeah, there is a Linux version too: https://code.visualstudio.com/docs/setup/linux
As for nREPL, yeah, if you're using Cursive you need nREPL. I think, for Socket REPLs, the only options are inf-clojure
in Emacs, Chlorine in Atom, and Clover in VS Code?
Hi! Maybe you are missing the last step at https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app/blob/master/how-to.md#create-components where you add the dev and test aliases to the Clojure Deps Project tab.
This screenshot specifically
Those two checkboxes should be checked for Cursive to resolve the source paths. Also there is this issue to improve the Polylith support in Cursive: https://github.com/cursive-ide/cursive/issues/2554
I think I am not getting something here. I am playing around with the Example app. I thought, lets just pull out the 'store' namespace into a component and then provide two different implmentations, one that uses jdbc, and a new on that would use datahike (datomic sort of).
poly create component name:store-jdbc interface:store
poly create component name:store-dh interface:store
This however just seems to be creating components that have the wrong path.
Do I need to create a thrid component 'store' that is only an interface? Or where does the pure interface code live?
You might also find the Swappable Implementations section of this blog post helpful @U0JE93A5V https://corfield.org/blog/2021/10/13/deps-edn-monorepo-7/
Each project depends on whichever implementation brick it wants. The development project uses the :+default
profile (alias) by default but you can select any other profile. You can therefore test by project and get whichever dep the projects
declare or, for :dev
, whichever profile you declare.
I think I understand that part, what I don't yet understand how exactly this is structured. I didn't realize that there was documentation on that under profiles.
It's nearly morning for you 🙂
Hit me up on DM tomorrow if you're still stuck on it and I'll try to walk you through what we've done, with two HTTP client implementations of the same interface.
i think of the interface pluggability strategy like .c
and .h
files except the linking is “explicit”
So my assumption above would be correct you pick a specific name for the component and general name for the interface?
And what about test, I assume you would want to have a general sets to test an interface, ignoring the implementation. Would you duplicate much of the test code as well?
Please use threads.