Fork me on GitHub

I’m building an electron app with hoplon/boot. Works great. But it would be nice to have source maps so I don’t have to work my poor tiny brain so hard to figure out where my exceptions are coming from. Currently, my files have source paths in them like "mission.html.out\/weathergen\/ui.cljs". Probably because of something to do with the fairly complicated setup involved in getting an Electron app working, this is incorrect. It should instead be simply "ui.cljs". It’s easy enough to write a task to rewrite these guys, but it’s not working. I think I’m doing something wrong with the Boot fileset stuff, where the modified file is not getting added to the output. I.e. when I look at the resulting files in the target directory, they still have the incorrect path, even though debug output in my task shows me that they should be getting rewritten correctly. I imagine I’m making some rookie mistake with tasks/filesets. Any idea what it might be?


OK, was missing a with-open on the writer, but that didn’t fix the problem. I can see that the temp output directory contains the correct file. It just doesn’t wind up making its way into the target folder.


I have a CLJ program that contains a server and a client in the same repository (they share a bit of code). I currently make an uberjar with the server code but now I would like to make a java .jar as well with the client. I am not sure how I should approach this with boot (or any other tool actually)?


(I don’t want to include everything in the driver - also the next step is to make a thin java wrapper around it and I will probably use the boot javac task as well)


One problem is that they have common dependencies as well (like timbre for instance).


You can have multiple folders, like client, server, and common and conditionally include subsets of those on the path when compiling.


symlinks also work well within git repositories.


I’ve used submodules at times to manage things like this, too, although that’s slightly more involved.


I don’t know how you’d manage multiple independent artifacts in a single, but I’m guessing you could just modify your paths and dependencies inside a task definition. If not, it’s not unreasonable IMO to have multiple projects in a single repo. It’s not done much in the Clojure world - for some reason we have this one repo = one project = one artifact mindset - so you might run into issues where tools make assumptions about the equivalence. But in general it should work.


Yes I am trying now. Looks like (sift :include #{"^client/*" #"^common/*"}) should work.


…or not. I am ending up with an empty jar (only manifest etc)


sift seems like a sort of odd way to do what you want, although I guess it should work. Again, not that I’ve done this, but I would be trying to do something like setting the environment as part of one of my build.boot tasks. Something like this:


(deftask client [] (merge-env! :source-paths #{"client"} ...) (comp (java ...)


That’s just off the top of my head, so probably broken.


No idea if it will work, either: have never tried to alter the environment inside a task.


Got my task working. No idea why it wasn’t working before; just kept making it look more and more like the example task until it started doing what I want it to.


Hm yes that looks cleaner to do it like that actually - I’ll try


The thing that bugs me about that approach is that you have side-effects in your task. Which is going to make them hard to compose.


I was looking for something like with-env in Boot, but it doesn’t seem to exist. Easy to build out of set-env! and get-env, though.


Or maybe Boot just really isn’t meant to create two artifacts from a single and you should have two.


Obviously, I’m not an expert.


I think it is possible to use a pod with it’s own env so I am no too worried by that. Also this is not so much a dev task (I want those to compose) as much as a task called once per build you want to release so even if it doesn’t it would be fine.


The thing is that at the moment I have “src/clj” “src/cljs” “src/cljc” folders, and that seems to complicate the task


Yeah, you don’t need to do that since the file extensions disambiguate.


I find it quite handy to just keep them in the same folders.


The correct one will get loaded: clj then cljc if Clojure, cljs then cljc if ClojureScript.


yes I read that recently

nha15:02:59 seems I end up without .clj files at the moment in my jar, but the “resources/” folder content is there


oh - maybe because those are .cljc files (?)


There’s a confusing thing about the terminology on “source paths” vs “resource paths”. One of them winds up in the JAR, one doesn’t, and I can never keep it straight. That may be what’s happening to you.


right - :resource-paths #{} and my jar is empty again. I need to include the sources now somehow - and make them accessible from java


If you want to call your Clojure code from Java your options are AOT (shudder) and using the Clojure API.


If you go the AOT route you won’t need the sources.


But it has a lot of sharp edges.


Of course if you go the Clojure API route you’re going to wind up with an API that won’t look familiar to most Java programmers.


Yes I saw this using the Clojure API - hence why I was planning to make a thin Java wrapper around the clojure code


But I still need to be able to publish a Clojure jar first 😛


Yeah, I think that’s a good option. You might even be able to generate it with Clojure. 🙂


Ahaha yeah 😛 one step at a time


Hi. I would like to create a Java Web Application using boot. Either an all-included mywebapp.war which I can drop into Tomcat8. Or an all-included mywebapp.jar which I can start with java -jar mywebapp.jar. Can anyone point me to a tutorial? Thank you!


hm it seems I end up with .class files in the .jar if I use the aot task, nothing but meta stuff otherwise


(but then some dependencies etc. end up in there as well)


How do I include a project directory into my webbap using the war task. I have a project directory with images, css and so on which needs to get into the root of the war file...


@witek something like (set-env! :resource-paths #{ "resources/"})


:resource-paths gets these files into WEB-INF/classes but not into / of the war file. :asset-paths seams to have no effect on war files 😞