Fork me on GitHub

hi when i run boot task which does (comp (aot) (repl {:server true ...})(new-system)(target)), and i have a core.clj file with only a -main function and (:gen-class :name myns.Core) , i can see the file created, but i cannot instantiate it, I get java.lang.NoClassDefFoundError: Could not initialize class myns.Core, i found that the issue to be java.lang.NoSuchMethodError: clojure.lang.Util.loadWithClass(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; which is referring to the clojure.lang.Util.loadWithClass method. I see that it is part of clojure lang and it has that method there, why is it not finding it? is it because the clojure.jar (or any of the dependencies) are not copied to the target directory?


i can instantiate other classes from package or any other ones from the libraries, but I cannot instantiate the gen-class created ones


any pointers on finding/understanding the issue would be greatly appreciated. It has taken the whole day but i can still not figure out what is causing it! 😞


About replacing strings in files, I got a task working, but on 250 files it takes about 2500ms while sed does it in 300ms. Probably doing something very inefficiently. Code review welcome:


Ok, got it down to 450ms now with the updated script. I guess that is acceptable?


@vikeri What does the updated script look like?


@juhoteperi I updated it in place, so it’s the one that I pasted


Ah okay. Seems okay then, slurp and string replace performance is probably fine for smaller files.


Alright, what would a faster alternative be?


If it had to work with larger files, like hundedrs of megabytes, I think storing the file as string would get slow. Then you'd use something that doesn't require storing the whole file on memory, like streams or memory mapped IO. But I think it would be lots of work and probably no noticeable difference for small files.


I think sed works by reading the files line by line


Alright, yeah this is just sort of a hack for now. Hopefully we’ll sort out something more robust in the future.


there's also my favorite unix util, rpl:


decomplecting sed 🙂


I need to run both a (cljs :optimizations :advanced) for selenium testing and (cljs :optimization : none) for my development repl/server. I want both of these to trigger when I save a file. I am outputting the result of both into /target. Is there any way to specify that dev should go to /target and selenium testing should go to /selenium_target?


Basically I have some concern that maybe having two separate task writing to the same directory might be introducing errors...


@samedhi there is a target task


you can pass a dir


@thedavidmeister Thanks. That did it. I actually just skipped over it because I looked at the help for target and got -d, --dir PATH Conj PATH onto the set of directories to write to (target)


Which probably shows a lack of understanding, but that seems to say that you are adding (`conj`) a path into the set of directories written to (target).


@samedhi i think the -d option for target actually specifies the directories to write the current fileset into. So to get the fileset written into selenium_target that pipeline should end with (target :dir "selenium_target")


great article about making an FTP task


covers almost everything about making a task, except pods