First off, just to confirm my understanding, the server.json file at the root of the server instance is used by default, yes?
Yes, as documented here: https://commandbox.ortusbooks.com/content/embedded_server/serverJSON/serverjson.html
Second, to add a directory to the classpath, my understanding is that it should include something like this::
“libDirs”:"\path\to\my\jars\"
Sort of. You are correct that backslashes need to be escaped, but a path like that looks like a *nix path, which would use forward slashes. A path starting with a slash is assumed to be absolute so the path you have above on Windows would resolve to the root whatever drive letter was on your current working directory. Perhaps that’s what you wanted, but I assume not.
Does it go at the root of server.json?
No, it goes under app.libDirs as documented here: https://commandbox.ortusbooks.com/content/embedded_server/adding-custom-libs.html
Pro tip: use the CLI to set these with the “server set” command. Hitting tab will show you all the possible options.
And the paths listed should relative to the server root?
It depends. An absolute path is, well absolute! A relative path passed to a CLI param will be relative to the current working dir. a Relative path in a server.json will be relative to the directory that the JSON file lives in. (Note, server.json doesn’t be in the web root). A global server default config setting will be relative to the web root. So in your case, the answer would be yes if your server.json is in the web root.
Third, is it possible to add mappings via server.json?
No, but not to worry, we have another project that manages that and more called CFConfig.
https://www.ortussolutions.com/blog/introducing-cfconfig-a-new-way-to-manage-your-cf-servers-configuration-from-the-command-line
That project will not only allow you to list/add/edit/delete CF mappings from the command line, you can package a .cfconfig.json file that has your CF mappings in it along with datasources, mail servers, timeouts and anything else that can be set in the CF administrator.
Thanks!
~Brad
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com