Hello dear fellow developers,
First of all, I very much enjoy working with plantuml.
However, recently I decided to start to work on reducing boilerplate and went into some trouble trying to work with configuring skinparams and macros in separate files and including them via '-config plantuml.config'.
java -jar /path/to/plantuml.jar -config plantuml.config
only works when 'plantuml.config' is located in the same directory I am executing the jar from.
Alternatively, I can pass an absolute path. Which is both well on the command line.
However, I'd also like my previews in the IDE I'm working with to automatically load my config and share my diagrams with the team.
I am mainly using Visual Studio Code and VSCode-Plantuml on macOS to enjoy all the goodies on a Plantuml aware IDE.
Now comes the hard part. The plugin can be configured to use the '-config' command line argument, but only works when the passed config file path is an absolute path. Generally the plugin uses the JVM parameter '-Duser.dir' to tell java the user's working directory.
Experiments on the command line with plantuml.jar revealed that 'user.dir' is resolved for the diagrams to compile but not for the command line argument.
WORKS (from any directory):
java -jar -Duser.dir=/Users/Kolberg/development/local/diagrams ~/.vscode/extensions/jebbs.plantuml-2.9.4/plantuml.jar sources/diagramDir/SomeAwesomeStateMachine.puml
THROWS:
java -jar -Duser.dir=/Users/Kolberg/development/local/diagrams ~/.vscode/extensions/jebbs.plantuml-2.9.4/plantuml.jar -config sources/plantuml.config sources/diagramDir/SomeAwesomeStateMachine.puml
-->
Exception in thread "main" java.io.FileNotFoundException: sources/plantuml.config (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at java.io.FileReader.<init>(FileReader.java:58)
at net.sourceforge.plantuml.Option.initConfig(Option.java:367)
at net.sourceforge.plantuml.Option.<init>(Option.java:220)
at net.sourceforge.plantuml.Run.main(Run.java:79)
Here is my version info:
java -jar ~/.vscode/extensions/jebbs.plantuml-2.9.4/plantuml.jar -versionPlantUML
version 1.2018.03 (Thu Apr 05 18:59:15 CEST 2018)
(GPL source distribution)
Java Runtime: Java(TM) SE Runtime Environment
JVM: Java HotSpot(TM) 64-Bit Server VM
Java Version: 1.8.0_161-b12
Operating System: Mac OS X
OS Version: 10.14
Default Encoding: UTF-8
Language: en
Country: DE
Machine: DGMAC211s-MacBook-Pro.local
PLANTUML_LIMIT_SIZE: 4096
Processors: 8
Max Memory: 3,817,865,216
Total Memory: 257,425,408
Free Memory: 249,051,520
Used Memory: 8,373,888
Thread Active Count: 1
The environment variable GRAPHVIZ_DOT has not been set
Dot executable is /usr/local/bin/dot
Dot version: dot - graphviz version 2.40.1 (20161225.0304)
Installation seems OK. File generation OK