This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-21
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (27)
- # boot (16)
- # cider (1)
- # clara (54)
- # cljs-dev (4)
- # cljsjs (8)
- # cljsrn (25)
- # clojure (148)
- # clojure-dev (2)
- # clojure-finland (1)
- # clojure-france (18)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-russia (27)
- # clojure-sg (2)
- # clojure-uk (17)
- # clojurebridge (6)
- # clojurescript (70)
- # core-async (1)
- # css (6)
- # cursive (35)
- # data-science (3)
- # datomic (22)
- # events (4)
- # jobs (18)
- # jobs-discuss (14)
- # leiningen (4)
- # lumo (22)
- # off-topic (20)
- # om (5)
- # om-next (1)
- # onyx (47)
- # pedestal (107)
- # re-frame (43)
- # reagent (1)
- # ring (2)
- # ring-swagger (2)
- # rum (18)
- # sql (15)
- # unrepl (4)
- # vim (61)
- # yada (3)
im getting into a new clojure project and i would like to structure it as a monorepo. how should i go about handling it from intellij? so the directory structure would be something like:
monorepo/
├── .git
│ ├── HEAD
│ ├── config
...
│ └── refs
│ ├── heads
│ └── tags
├── backend
│ └── project.clj
├── expolre
│ ├── case-1
│ │ └── project.clj
│ └── case-2
│ └── project.clj
└── frontend
└── project.clj
the issue i see is that i have multiple lein projects within one git root, but i can't seem to add those as project modules
if i would create an intellij project for each of those dirs with project.clj
files, then the git root would be outside of the intellij project root
@onetom That should be no problem. If you use File->New project from existing sources…, then choose your monorepo dir and lein, then you should get the option to import projects recursively. That will set your project root at the git root, and the modules will be in the correct place.
That sounds promising. What do I do when I have a new module? When I tried to add one I was only ourselves with the option of adding a Clojure project, not a Leiningen one. And the dialog was also suggesting it's for creating a library package in a Java sense
You can add a new module either from Cursive using File->New->Module… or add it from the command line, and then right-click the project.clj in the project view and “Add lein project” (I think, don’t have Cursive open here).
Basically, it’s easy to add and remove modules as you like, and Cursive will adapt the project as required and work out cross-module deps etc.
https://cursive-ide.com/userguide/leiningen.html, under “Working with multi-module projects”
I think the screenshots are slightly out of date, they’re from an older version of IntelliJ.
i see. now i remember i read it years ago. it's a slightly different example because the vcs root also contains a project and you are talking about dependent projects.
i think my confusion is rooted in the fact that in reality i have boot projects not lein projects, so initially i don't have project.clj
files.
i tried to open the directory with the plain File/Open...
menu item, just so i can edit the build.boot
files and add my lein-generate
boilerplate to them, to allow me generating the initial project.clj
s.
BUT if i do so, intellij automatically creates a module named after the root dir of the monorepo.
when i try to add modules to it with the "New Module" menu item, the new module do not appear immediately.
i have to close the project dialog and open it again.
looks like some bug in intellij, which hasn't been fixed for years now.
and even before I would try the New Module
menu I've instinctively tried to click on the Clojure
option, which now I've noticed is under the divider called ---Framework---
which btw, i have no idea what does it do, since nothing seems to be changed after i've added it. (i've skipped the add libraries option though in the following dialog, so i guess it would just register/download a basic set of jars necessary to run clojure?)
Just out of curiosity, if I have such a multi module project, are the IntelliJ indexes for a specific version of a dependency generated for every module which uses that exact dependency?
In other words am I better off from memory usage perspective having one multi-module IntelliJ project open than having a separate project for every module?
I’m trying to rebind Navigate-> Declaration to CMD-. Intellij inserts an A
in the field instead of the CMD sign and a .
If I try to rebind to CMD-, it works as expected. Is it me, Intellij, or Cursive?
@slipset if you could show a screenshot i could try it on my side to see if it's reproducible or not
what's interesting is that the dialog becomes taller after pressing cmd-. it seems like it's trying to show a message similar to the message we get when pressing cmd-,
it doesn't depend on which action am i trying to add the cmd-. keyboard shortcut to. i tried it on Editor actions / Backspace for example.