Fork me on GitHub
#boot
<
2016-12-28
>
neupsh03:12:22

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 Core.java 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?

neupsh03:12:29

i can instantiate other classes from http://java.xxx package or any other ones from the libraries, but I cannot instantiate the gen-class created ones

neupsh03:12:18

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! 😞

vikeri12:12:48

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:

vikeri12:12:34

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

juhoteperi12:12:37

@vikeri What does the updated script look like?

vikeri12:12:00

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

juhoteperi13:12:35

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

vikeri13:12:15

Alright, what would a faster alternative be?

juhoteperi13:12:32

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.

juhoteperi13:12:22

I think sed works by reading the files line by line

vikeri13:12:47

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

pesterhazy13:12:51

there's also my favorite unix util, rpl: https://linux.die.net/man/1/rpl

pesterhazy13:12:32

decomplecting sed 🙂

samedhi15:12:54

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?

samedhi15:12:22

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

thedavidmeister15:12:53

@samedhi there is a target task

thedavidmeister15:12:20

you can pass a dir

samedhi15:12:30

@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)

samedhi15:12:17

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).

geoffs17:12:44

@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")

alandipert18:12:53

great article about making an FTP task

alandipert18:12:05

covers almost everything about making a task, except pods