Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Calva by
retagged by

I was playing around with fulcro https://github.com/fulcrologic/fulcro-template#the-api-server

In the readme of the fulcro-template, it said clj -A:dev -J-Dtrace -J-Dguardrails.enabled=true to start a backend server. And use any editor that has REPL integration, like Cursive.

I can start repl using calva jack-in, but how can I add additional parameters like -J-Dtrace -J-Dguardrails.enabled=true

1 Answer

+1 vote
selected by
Best answer

Calva does not have configuration designed for setting Java options. That doesn't mean you don't have options, though. First some general background:

You can provide these via :jvm-opts on an alias in deps.edn, or via the environment variable JAVA_TOOL_OPTIONS. Something like this would be an equivalent command line invokation (assuming something Unix-like):

JAVA_TOOL_OPTIONS='-Dtrace -Dguardrails.enabled=true' clj -A:dev

You then can use the command Calva: Copy Jack-in Command Line to Clipboard, to get the REPL started in a Calva compliant way, then use Calva: Connect to a Running REPL in your Project, to connect to it.

However, you can also use Jack-in. Calva has a settings calva.jackInEnv, where you can provide this environment variable, and Jack-in should work.

Yet another, Jack-in compatible, option is to add this in your deps.edn. Something like:

:aliases {:dev {:jvm-opts ["-Dtrace" "-Dguardrails.enabled=true"]}}

You could then specify the :dev alias at Calva Jack-in.

I think I would go with the last one, as it makes the project config portable and easy for others to use.

Hoping this helps! Here is an article about Calva Jack-in that probably is good to read.