Fork me on GitHub
#kaocha
<
2023-03-03
>
Noah Bogart15:03:31

i'm working on a project I want to compile to an uberjar, so I have (:gen-class) in the main namespace. If I don't pre-compile this (using tools.build for example) Kaocha can't run

Noah Bogart15:03:13

$ clojure -M:test

Randomized with --seed 232372349
ERROR in all (noahtheduke/splint.clj:5)
Failed loading tests:
Exception: clojure.lang.Compiler$CompilerException: Syntax error compiling at (noahtheduke/splint.clj:5:1).
#:clojure.error{:phase :compile-syntax-check, :line 5, :column 1, :source "noahtheduke/splint.clj"}
 at clojure.lang.Compiler.analyze (Compiler.java:6825)

Noah Bogart15:03:56

if I use the gen-class-hook as described https://github.com/plexus/gen-class-hook, then I get a different error related to the function compile being unable to find the relevant class:

$ clojure -M:test
Syntax error (ClassNotFoundException) compiling at (noahtheduke/splint.clj:5:1).
noahtheduke.splint

Full report at:
/var/folders/5w/z50rbwg546x94k8p8jzqfbl00000gn/T/clojure-1175603925556261433.edn
noah@Noahs-MacBook-Pro ~/personal/splint  [main ≡ +1 ~89 -1 | +1 ~4 -0 !]
$ cat /var/folders/5w/z50rbwg546x94k8p8jzqfbl00000gn/T/clojure-1175603925556261433.edn
{:clojure.main/message
 "Syntax error (ClassNotFoundException) compiling at (noahtheduke/splint.clj:5:1).\nnoahtheduke.splint\n",
 :clojure.main/triage
 {:clojure.error/phase :compile-syntax-check,
  :clojure.error/line 5,
  :clojure.error/column 1,
  :clojure.error/source "splint.clj",
  :clojure.error/path "noahtheduke/splint.clj",
  :clojure.error/class java.lang.ClassNotFoundException,
  :clojure.error/cause "noahtheduke.splint"},
...

Noah Bogart15:03:26

compiling from the repl works too:

$ clj
Clojure 1.11.1
user=> (compile 'noahtheduke.splint)
noahtheduke.splint

Noah Bogart15:03:38

so I'm unsure what kaocha is doing that causes this to happen, but it's cumbersome that I have to pre-compile before I can run kaocha directly

Noah Bogart15:03:45

any thoughts or ideas?

Alys Brooks05:03:05

Strange, I am able to clone the repo and run tests with clojure -A:test:kaocha

Alys Brooks05:03:45

without manually running (compile ,,,)

Alys Brooks05:03:52

If you're still encountering the issue, can you provide the full stacktrace file?

Noah Bogart16:03:24

ah crap, i'm sorry I missed that you responded

Noah Bogart16:03:07

i don't know what changed but you're correct that it's working now

Noah Bogart17:03:56

thanks for trying it out

Alys Brooks17:03:51

You're welcome!

Noah Bogart19:03:25

okay, here we go. i wrote rm -rf classes/ ; mkdir classes and then ran clojure -M:dev:test :kaocha and it crashed

Noah Bogart04:05:01

okay, so i just tried this again and it only crashes on osx lol

Noah Bogart04:05:14

idk about windows, but on my ubuntu computer, it works just fine