I'm using PlantUML v1.2019.13
I have 2 files: a.uml, and b.uml. a.uml includes subpart from b.uml, and b.uml includes subpart from a.uml.
It's very important not to include whole file content, so i use !startsub !ensub and !includesub.
Using include guard (!includesub inside condition block) cause an exception (same behavior when there is no condition).
a.uml
@startuml
!startsub DO_NOT_WANT_TO_INCLUDE_THIS
!log A.BRIEF
!endsub
!startsub DETAILS
!log A.DETAILS
!$HAVE_MODULE_A = 1
component [a] as A
!if (%not(%variable_exists("$HAVE_MODULE_B")))
!includesub b.uml!DETAILS
!endif
component [a1] as A1
component [a2] as A2
A <-- A1
A <-- A2
A <-- B
!endsub
@enduml
b.uml
@startuml
!startsub DO_NOT_WANT_TO_INCLUDE_THIS
!log B.BRIEF
!endsub
!startsub DETAILS
!log B.DETAILS
!$HAVE_MODULE_B = 1
component [b] as B
!if (%not(%variable_exists("$HAVE_MODULE_A")))
!includesub a.uml!DETAILS
!endif
component [b1] as B1
component [b2] as B2
B <-- B1
B <-- B2
B <-- A
!endsub
@enduml
java -jar plantuml.jar a.uml 2>&1 | head
[Log] A.BRIEF
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.io.UnixFileSystem.resolve(UnixFileSystem.java:104)
at java.base/java.io.File.<init>(File.java:366)
at net.sourceforge.plantuml.AParentFolderRegular.getAFile(AParentFolderRegular.java:62)
at net.sourceforge.plantuml.preproc.ImportedFiles.getAFile(ImportedFiles.java:85)
at net.sourceforge.plantuml.preproc.FileWithSuffix.<init>(FileWithSuffix.java:127)
at net.sourceforge.plantuml.tim.TContext.executeIncludesub(TContext.java:593)
at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:204)
at net.sourceforge.plantuml.tim.TContext.runSub(TContext.java:623)
What is the valid way to include looped subparts and make an include guard in PlantUML?