(ns dev.lisa)
(+ 1 2 3)
We only currently specifically describe IntelliJ IDEA with Cursive Setup.
If you are using a different IDE, here’s the generic goals:
Setup your IDE’s REPL to startup with dev
and test
aliases
Notice that your ./deps.edn
already has development/src
on the path for the dev
alias
Add sample source development/src/dev/lisa.clj
:
(ns dev.lisa)
(+ 1 2 3)
Evaluate dev.lisa
in your IDE REPL to test.
Celebrate a successful IDE setup!
Here, we share some specific setup instructions when using Cursive.
First, make sure you have tools.deps configured correctly.
To import a Polylith workspace as a project:
Select File > New > Project from Existing Sources…
from the menu.
A wizard will guide you through the import:
Start with selecting the ./deps.edn
file
When asked, choose your desired version of the Java SDK
Otherwise, hit Next
and finally Create
.
If you are using Cursive 1.13.0
or later, follow the instructions here.
From the Clojure Deps
tab (by default, it’s on the far right), enable dev
under Aliases
, then press the icon with two arrows to refresh:
To create a REPL, select Current File > Edit Configurations…
:
Then click the +
sign and select Clojure REPL > Local
:
Configure like so:
Name:
type REPL
Which type of REPL to run
choose nREPL
How to run it
choose Run with Deps
Options:
type -A:dev:test
Common Options > Module:
select your Polylith workspace directory, e.g., example
Press OK
. Now start the REPL in debug mode by clicking the bug icon:
Under the REPL
view, you should soon see something like:
Clojure 1.11.1
nREPL server started on port 56855 on host localhost - nrepl://localhost:56855
You have configured everything tools.deps needs and are ready to write some Clojure code!
Look at the generated ./deps.edn
file.
Notice that it already includes development/src
on the path under the :dev
alias:
:aliases {:dev {:extra-paths ["development/src"]
(You might remember we had you enable the dev
alias above under Clojure Deps
and for the REPL via -A:dev:test
.)
To get started, create a dev namespace.
We suggest you use dev
as a top namespace here, not your workspace top namespace.
This strategy keeps your production code entirely separate from your development code.
One way to structure dev code is to give each developer their own namespace under dev
.
Following this pattern, create the namespace dev.lisa
:
Right-click on the development/src
directory, select New > Clojure Namespace
, and type dev.lisa
.
A dialog will pop up and ask you if you want to add the file to git:
Check Don’t ask again
and click the Add
button.
If the namespace is not recognized, you may need to click the icon with two arrows under the Clojure Deps
tab to refresh:
Now you can write some code in lisa.clj
:
(ns dev.lisa)
(+ 1 2 3)
Load the namespace by sending (ns dev.lisa)
to the REPL.
Send (+ 1 2 3)
to the REPL.
You should see 6
in the REPL view.
Congratulations, you now have a working development environment!
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close