'Can't render component diagram with PlantUML in IntelliJ
I am trying to create a component diagram using the PlantUML plugin for IntelliJ. I have installed the plugin and worked with it before. However, when I try to render a component diagram, I get an error:
Cannot find Graphviz
I've also checked with other diagrams and a sequence diagram is still working just fine.
What is the problem here?
Solution 1:[1]
Sequence diagrams and activity diagrams work out of the box.
For other types of diagrams, you need to have Graphviz installed (version > 2.26.3
).
- If you don't have Graphviz installed - just install it.
- If you have it installed but its version is improper - reinstall it.
- If you have it installed in proper version but location is other than default - point to that location. You can manage that either by specifying env variable
GRAPHVIZ_DOT
containing a path to Graphviz executable or pointing it out directly from IntelliJ's PlantUML plugin settings.
Here, you can read more on how to install Graphviz to get along with PlantUML.
Btw. I solved the same problem by simply typing sudo apt-get install graphviz
in my console - maybe would work for you as well.
Solution 2:[2]
If you:
1.installed Graphviz
2.configured GRAPHVIZ_DOT
env var to your dot.exe
file
(example D:\Program Files (x86)\Graphviz2.38\bin\dot.exe
)
And you're still getting the same error: Cannot find Graphviz1
.
You probably need to configure the path to the dot.exe
inside the Intelij settings.
Follow this tutorial to do so.
Solution 3:[3]
On a mac using Intellij, if Intellij cannot find graphviz, testdot doesn't work and graphviz was installed with brew install graphviz
:
- In Intellij, click the wrench icon on the far right of the menu panel that contains the plantuml view and editor arrangement.
- Click 'Open settings'
- For 'Graphviz dot executable' add
/opt/homebrew/bin/dot
. - Click OK and restart Intellij.
This fixes the issue for me.
You can check first that you really are missing the /opt/local/bin/dot
(or whatever path you're shown is broken) and the /opt/homebrew/bin/dot
exists, but likely the reason is that brew put dot under its own path.
Solution 4:[4]
As mentioned here https://plantuml.com/graphviz-dot
Since version 1.2021.5, you can experimentally use PlantUML without installing Graphviz if you add
!pragma layout smetana
to your diagrams for the supported types. In that case, the "Smetana" engine is used instead of Graphviz
Therefore this worked for me;
@startuml
!pragma layout smetana
...
@enduml
I hope it helps!
Solution 5:[5]
I had trouble too...the easiest way is to install the VsCode plugin 'Markdown Preview Enhanced' and then...magically...IntelliJ works fine too!!!
Solution 6:[6]
In case it helps someone, these are the steps to resolve the same error (Can not find GraphViz...
) from Eclipse editor.
Install GraphViz on your system. Depending on your system, installation instructions are here: https://graphviz.org/download/ . For Mac (v11.6) users, it is as simple as
brew install graphviz
After installation is completed, add an environment variable:
GRAPHVIZ_DOT
to point to the path of thedot
executable. On my machine, I added this:export GRAPHVIZ_DOT=/opt/homebrew/bin/dot
Add path of the
dot
executable to Eclipse PlantUml preferences (Preferences --> Plant UML --> Path to the dot executable of Graph Viz
). Screen shot given below:
Solution 7:[7]
First install graphviz
Find dot executable and put it where IntelliJ can find it
- Windows: Add the dot executable path in the environment variables path settings
- Linux: find the location of dot using
where dot
and if it's not in the/opt/local/bin
you can just create a symbolink link from lets say/usr/local/bin
by runningln -s /usr/local/bin/dot /opt/local/bin/dot
Restart IntelliJ
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pang |
Solution 2 | Dor Sloim |
Solution 3 | Tanel |
Solution 4 | Jimmy_Rw |
Solution 5 | agelbess |
Solution 6 | |
Solution 7 | Noman |