Fork me on GitHub
#depstar
<
2021-02-01
>
danielneal10:02:28

Heya, I'm new to depstar. I'm trying to make an uberjar for a project that uses malli. To allow use of a custom registry in malli I need to set the following jvm opts ["-Dmalli.registry/type=custom"]. Where should this go when building an uberjar with depstar?

dharrigan10:02:51

Here's an example...

dharrigan10:02:10

:uberjar {:replace-deps {seancorfield/depstar {:mvn/version "2.0.171"}}
                     :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
                     :exec-fn hf.depstar/uberjar
                     :exec-args {:jar foo.jar
                                 :group-id foo
                                 :artifact-id bar
                                 :version "0.0.0"
                                 :main-class foo.bar.main
                                 :aot true
                                 :sync-pom true}}}

danielneal10:02:21

ah interesting, that's what I have

danielneal10:02:45

this is how it failed:

[main] INFO hf.depstar.uberjar - Compiling sqa.main ...
Execution error (ExceptionInfo) at malli.registry/set-default-registry! (registry.cljc:30).
can't set default registry

Full report at:
/var/folders/38/bhb_3y9d70dd6vzvnf9tdbm80000gn/T/clojure-7407818078122203090.edn

[main] ERROR hf.depstar.uberjar - Compilation of sqa.main failed!
[main] ERROR hf.depstar.uberjar - AOT FAILED

danielneal10:02:10

where set-default-registry! is the command that requires the system property set

dharrigan10:02:45

Don't know why AOT failed 😞

dharrigan10:02:52

That's probably a side effect

dharrigan10:02:52

Maybe the / is confusing the java opts?

dharrigan10:02:01

Seems okay on their documentationp age

danielneal10:02:03

yeah the jvm opt works fine normally

dharrigan10:02:42

what does the full report say?

dharrigan10:02:01

It should give a reason

danielneal10:02:03

{:clojure.main/message
 "Execution error (ExceptionInfo) at malli.registry/set-default-registry! (registry.cljc:30).\ncan't set default registry\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 30,
  :clojure.error/cause "can't set default registry",
  :clojure.error/symbol malli.registry/set-default-registry!,
  :clojure.error/source "registry.cljc",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message "Syntax error macroexpanding at (schema.clj:35:1).",
    :data
    {:clojure.error/phase :execution,
     :clojure.error/line 35,
     :clojure.error/column 1,
     :clojure.error/source "schema.clj"},
    :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3707]}
   {:type clojure.lang.ExceptionInfo,
    :message "can't set default registry",
    :data {:type "default"},
    :at
    [malli.registry$set_default_registry_BANG_
     invokeStatic
     "registry.cljc"
     30]}],
  :trace
  [[malli.registry$set_default_registry_BANG_
    invokeStatic
    "registry.cljc"
    30]
   [malli.registry$set_default_registry_BANG_
    invoke
    "registry.cljc"
    27]
   [sqa.schema$init_schema_registries invokeStatic "schema.clj" 31]
   [sqa.schema$init_schema_registries invoke "schema.clj" 28]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3204]
   [sqa.leo$loading__6721__auto____31503 invoke "leo.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 619]
   [sqa.user$loading__6721__auto____31501 invoke "user.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3894]
   [sqa.bl$loading__6721__auto____15102 invoke "bl.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3894]
   [sqa.api_common$loading__6721__auto____13934
    invoke
    "api_common.clj"
    1]

danielneal10:02:15

(sorry it's massive 😄 )

danielneal10:02:03

interestingly, tonskys uberdeps seems to work. I do have to pass the jvm opt to the finished jar, but putting the jar together succeeds.

dharrigan10:02:27

try the same with depstar? Build without the -D, but pass it in when run?

seancorfield17:02:37

@danieleneal Currently, there's no way to tell depstar about JVM options for compilation but I plan to address that in the next release: https://github.com/seancorfield/depstar/issues/64