Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlantUml Plugin 8.12.1 - GraphViz und ImageIO Problems #1302

Open
mncod1ng opened this issue Feb 19, 2025 · 9 comments
Open

PlantUml Plugin 8.12.1 - GraphViz und ImageIO Problems #1302

mncod1ng opened this issue Feb 19, 2025 · 9 comments
Assignees
Labels

Comments

@mncod1ng
Copy link

mncod1ng commented Feb 19, 2025

Hi,

I observed some issues related to the PlantUml Plugin 8.12.1 and how System Variables are evaluated when running the gradle task.
I am a Windows user.

First issue: Graphviz dlls are not found

java.io.FileNotFoundException: C:\WINDOWS_graphviz\cdt.dll (Das System kann den angegebenen Pfad nicht finden)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:235)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:184)
at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.extract(WindowsDotArchive.java:103)
at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.getWindowsExeLite(WindowsDotArchive.java:129)
at net.sourceforge.plantuml.dot.GraphvizWindowsLite.specificDotExe(GraphvizWindowsLite.java:57)
at net.sourceforge.plantuml.dot.AbstractGraphviz.searchDotExe(AbstractGraphviz.java:90)
at net.sourceforge.plantuml.dot.AbstractGraphviz.(AbstractGraphviz.java:75)
at net.sourceforge.plantuml.dot.GraphvizWindowsLite.(GraphvizWindowsLite.java:68)
at net.sourceforge.plantuml.dot.GraphvizUtils.create(GraphvizUtils.java:109)
at net.sourceforge.plantuml.svek.DotStringFactory.getGraphvizVersionInternal(DotStringFactory.java:271)
at net.sourceforge.plantuml.svek.DotStringFactory.getGraphvizVersion(DotStringFactory.java:265)
at net.sourceforge.plantuml.svek.GraphvizImageBuilder.printEntityInternal(GraphvizImageBuilder.java:380)
at net.sourceforge.plantuml.svek.GraphvizImageBuilder.printEntity(GraphvizImageBuilder.java:362)
at net.sourceforge.plantuml.svek.GraphvizImageBuilder.printEntities(GraphvizImageBuilder.java:354)
at net.sourceforge.plantuml.svek.GraphvizImageBuilder.buildImage(GraphvizImageBuilder.java:224)
at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFileInternal(CucaDiagramFileMakerSvek.java:103)
at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFile(CucaDiagramFileMakerSvek.java:69)
at net.atmp.CucaDiagram.exportDiagramInternal(CucaDiagram.java:475)
at net.sourceforge.plantuml.classdiagram.ClassDiagram.exportDiagramInternal(ClassDiagram.java:83)
at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:139)
at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:210)
at net.sourceforge.plantuml.PSystemUtils.exportDiagramsDefault(PSystemUtils.java:207)
at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:96)
at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:190)
at io.freefair.gradle.plugins.plantuml.PlantumlAction.execute(PlantumlAction.java:34)

Interpretation:

  • It seems that GRAPHVIZ_DOT (which is used in PlantUml to search for the Graphviz dot.exe) cannot be set in the build.gradle. Therefore it defaults to {java.io.tmpdir}_graphviz in src/net/sourceforge/plantuml/windowsdot/WindowsDotArchive.java. But for some reason java.io.tmpdir is not what System.getProperty("java.io.tmpdir") returns in my gradle.build but C:\WINDOWS

I found an ugly workaround:
1.1) As a workaround I added the required folder in C:\WINDOWS and added the missing dlls available from the newest GraphViz Zip Archive.
1.2) I also needed to add an expat.dll. It was not included in the GraphViz Zip Archive and I got it from https://github.com/ErwinJanssen/graphviz-windows-dependencies.

Second issue: But even after fixing these issues by my workaround I still have the following problem:

Caused by: java.nio.file.AccessDeniedException: C:\WINDOWS\imageio16452219325278130177.tmp
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
at java.base/java.nio.file.Files.createFile(Files.java:658)
at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:136)
at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:159)
at java.base/java.nio.file.Files.createTempFile(Files.java:923)
at java.desktop/javax.imageio.stream.FileCacheImageInputStream.(FileCacheImageInputStream.java:102)
at java.desktop/com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(InputStreamImageInputStreamSpi.java:69)
at java.desktop/javax.imageio.ImageIO.createImageInputStream(ImageIO.java:359)
... 41 more

Task :plantUml FAILED

Execution failed for task ':plantUml'.

Multiple task action failures occurred:
A failure occurred while executing io.freefair.gradle.plugins.plantuml.PlantumlAction

Interpretation:

  • It seems that ImageIO Default Cache is null. There TempFileHelper uses then java.io.tmpdir as well which again is C:\WINDOWS.

Conclusions:

  • Both issues seem to be caused by System Variables not correctly used. My Windows System Variables are different from the values I see when the gradle task is executed. I am not able to set the variables in build.gradle.

If you have some advice or can fix the bug, I would be glad. Thanks alot.

@Frisch12
Copy link
Member

Hello @mncod1ng,

Thanks for reporting the issue 👍

Initially, it appears your Windows temporary folder setting is incorrect. The TEMP variable should point to your user's temporary directory or C:\Temp; C:\Windows is an unsuitable location for TEMP. You could try configuring the TEMP environment variable correctly or specifying it within your Gradle build (e.g., -Djava.io.tmpdir=C:\temp).

The temporary files are created in this directory, so if it's set to C:\Windows, that's where the build's temporary files will be located.

Please verify your system's environment variables and ensure they are accurate. If this doesn't resolve the problem, try setting it as a parameter in your Gradle build via the command line.

I will submit a pull request later to enable setting this variable as a parameter within the PlantUML task/plugin.

Regards,
Dennis

@Frisch12 Frisch12 self-assigned this Feb 20, 2025
@Frisch12 Frisch12 added the bug label Feb 20, 2025
@mncod1ng
Copy link
Author

mncod1ng commented Feb 20, 2025

Hi @Frisch12,
I know that C:\Windows is unsuitable, but my System Variables are correctly set. I even did very verify this by adding a logging for the values in my build.gradle file.

Image

Nevertheless I get the error message with regard to ImageIO.

@mncod1ng
Copy link
Author

Update: I have found a better workaround. Run Intellij on Windows 11 in administrator mode. Then all works fine.

@Frisch12
Copy link
Member

Interesting, that this makes a difference. I'll have a look into this behaviour.

larsgrefer added a commit that referenced this issue Feb 22, 2025
@marcphilipp
Copy link

@larsgrefer The change from 842abef causes the following failure using Gradle 8.13-rc-2: https://ge.junit.org/s/v5iyhjbxkmxdo/failure#1

Frisch12 added a commit that referenced this issue Feb 25, 2025
larsgrefer added a commit that referenced this issue Feb 25, 2025
Frisch12 added a commit that referenced this issue Feb 25, 2025
…-tmpdir

#1302 fixes java fork options serialization issue and adds tmpdir to task properties
@Frisch12
Copy link
Member

Frisch12 commented Mar 3, 2025

@marcphilipp @mncod1ng I've released a new version. Can you test it please?

@marcphilipp
Copy link

@Frisch12 Thanks, that resolves the problem for the JUnit repo: 👍

@Frisch12
Copy link
Member

Frisch12 commented Mar 4, 2025

Perfect. Thank you for your feedback and your patience 👍

@mncod1ng
Copy link
Author

mncod1ng commented Mar 5, 2025

Hi,

I was afk for some days. I tested your newest plugin version and now it works all fine. Thanks a lot for fixing my issues so fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants