poly
Search
⌃K

Development

When working with a Polylith codebase, we are free to choose any editor/IDE we like, for example Emacs/Cider, VSCode/Calva or IDEA/Cursive. Here we will use Cursive, and if you do, make sure you have tools.deps configured correctly.
Let's get started by creating a project. From the menu, select File > New > Project from existing sources. Select the deps.edn file, the desired version of SDK and finish the wizard.
Make sure to activate the :dev alias (and press the "two arrows" icon to refresh):
Let's create a REPL by clicking Add Configuration:
Click the + sign and select Clojure REPL > Local:
Fill in:
  • Name: REPL
  • Which type of REPL to run: nREPL
  • Run with Deps: (select)
  • Aliases: test,dev
Press OK and start the REPL in debug mode, by clicking the bug icon:
When this turns up:
nREPL server started on port 53536 on host localhost - nrepl://localhost:53536
Clojure 1.10.3
...we are ready to go!
If we look at the deps.edn file again, we can see that "development/src" was already added to the path:
:aliases {:dev {:extra-paths ["development/src"]
This gives us access to the development/src directory so that we can work with the code. Right now there is only one directory here, but every time we create a new component or base, we normally add them to the path too (the exception is if you have several components sharing the same interface, but more on that later).
The "development/src" path belongs to the dev alias which we activated previously and also added to the REPL by selecting the "dev,test" aliases. This means that we have configured everything that tools.deps needs and that we are ready to write some Clojure code!
To do that we first need to create a namespace. We suggest that you use dev as a top namespace here and not the workspace top namespace se.example. The reason is that we don't want to mix the code we put here with the production code.
One way of structuring the code is to give all developers their own namespace under the dev top namespace. Let's follow that pattern and create the namespace dev.lisa.
Right click on the development/src directory and select New > Clojure Namespace and type "dev.lisa":
When this dialog turns up, select "Remember, don't ask again" and click the Add button:
Now let's write some code:
(ns dev.lisa)
(+ 1 2 3)
Make sure the namespace is loaded, by sending (ns dev.lisa) to the REPL. If we then send (+ 1 2 3) to the REPL we should get 6 back, and if we do, it means that we now have a working development environment!