Fork me on GitHub
#leiningen
<
2017-10-03
>
noman05:10:53

hey guys is there something in lein that will reload my app when there are changes? so i don't have to ctrl + c and restart?

lsenjov05:10:46

Reload what in particular?

noman05:10:03

like i'm working on a server and running it on localhost for dev

noman05:10:25

and it would be nice if lein run would reload itself when changes were made

lsenjov05:10:01

Oh there's a plugin for that. Give me a moment

noman05:10:07

cool, thanks

lsenjov05:10:52

Look up lein reload and lein auto reload

noman05:10:59

nice, thank you

lsenjov05:10:31

Although editors with repl functionality usually have the ability to reload a namespace

lsenjov05:10:02

Vim-fireplace has Require! for example

lsenjov05:10:37

Also, be aware that reloading on save may cause issues if you're not completely sure of what you're saving

lsenjov05:10:51

Endless loops in code, for example

noman05:10:05

yeah that's a good point

lsenjov05:10:06

If you're running an editor with repl integration, they usually have a motion to send the current form off, so full namespace reload is only usually needed when playing with protocols and other fun things

lsenjov05:10:22

Anyways, hope that helped

noman05:10:51

thanks for all the advice, i'm gonna check out some of the plugins and see how bad it could possibly be

lsenjov05:10:19

Oh, if you're running a ring server you'll want the reload middleware from that instead

noman05:10:30

i'm using compojure which i believe uses ring?

lsenjov05:10:42

Reloading the namespace has issues due to when things are attached

noman05:10:02

you mean like sockets and stuff?

lsenjov05:10:32

Errr ring.middleware.reload/wrap-reload

lsenjov05:10:05

Nah, iirc when routes are declared the functions are compiled and attached

noman05:10:39

oh, attached in that sense

lsenjov05:10:46

Reloading the namespace changes the functions, but not the ones attached to the routes

lsenjov05:10:29

The reload middleware searches on request and recompiles the namespace accordingly

lsenjov05:10:45

(And recompiles the routes)

markbastian18:10:51

hey folks, is there an easy way to swap the name of my jar and uberjar in lein?

markbastian18:10:30

say :jar-name foo-min-SNAPSHOT-1.1.jar and :uberjar-name foo-SNAPSHOT-1.1.jar?

markbastian18:10:51

assuming project name is foo

markbastian20:10:29

;; Including %s will splice the project version into the filename. :jar-name "sample.jar"

markbastian20:10:59

so, does this mean I can do "sample-%s.jar" for example?

markbastian20:10:17

actually, it looks like :version and :name are both being referenced. I wonder if there's a way to get the project in a repl and dump the map.

danielcompton22:10:33

You can use the profile in the target directory name, so maybe that too?