plantuml/plantuml-stdlib

Includes not working - Integration of Plantuml with Gradle Tasks using PlantUML jar

adrinerandrade opened this issue · 1 comments

Hello everyone,

I'm trying to use the PlantUML with Standard Libraries to work with Gradle Tasks to generate the svgs of the diagrams after the project build.

I created the following task:

dependencies {
  ///...
  implementation 'net.sourceforge.plantuml:plantuml:8059'
}

task generatePlantUML(type: JavaExec) {
  mainClass = 'net.sourceforge.plantuml.Run'
  classpath sourceSets.main.runtimeClasspath
  args '-tsvg', '-o', 'generated', 'src/main/resources/diagrams/*.puml'
}

And in my .puml file, I have this includes:

!include <C4/C4_Container>
!include <tupadr3/devicons/java>
!include <tupadr3/devicons/redis>
!include <tupadr3/devicons2/mongodb>
!include <tupadr3/devicons2/spring>
!include <tupadr3/font-awesome/server>
!include <tupadr3/font-awesome/database>

The file works perfectly with Intellij PlantUML Plugin. But when running the task, with the .jar, I get the following error:

Cannot include C:\Users\2160002527\dev\poc-gradle-puml\src\main\resources\diagrams\&lt;C4\C4_Container&gt;

It's not interpreting standard libraries and neither working with url paths. Just working with local files. I tried some approaches based in the security documentation but it didn't work too.

Reading the documentation it was not clear to me, how to use Standard Libraries with the plantuml .jar. Is it possible? What I'm missing?

If is a missconfiguration or limitation in the library, my suggestion is to add a section in the documentation of this repository covering this topic.

I got the error. It was the artifact version, when openning the .jar file version 1.2023.10 there was a link to the version 8059 as it was the newest version. Probably some repository configuration. With the version 1.2023.10 everything works fine.

If you guys think it would be helpful to another people, I can add a section in the documentation about creating a gradle task to generate the diagrams. Then this can be configured directly in the CI/CD flow.

Thank you!