Includes from Classpath or local Zip-file

0 votes
asked Aug 21, 2018 in Wanted features by mgrol (3,150 points)
edited Aug 22, 2018 by mgrol

Hi,

in http://forum.plantuml.net/4080/please-provide-commands-import-png-and-svg-images-from-files?show=4080#q4080 a possibility to include sprites from png and svg via jar-file. Is there any possible way to include iumls and pumls that way.

I have a huge  number of iuml/puml that include each other to represent Services and subsequent services. I use these with component and sequence diagrams. Now, I would like to add this definitions to the plantuml jar via -cp or another argument. So that, instead asking everyone who wants to use my macros to check out my git repo and adding an "!include ../My_Service/my_method.iuml" to include these this service these are provided with the argument above. Then, I'd like to simplify my includes like this: !include my_service.jar:My_Service/my_method.iuml or, even better, like the stdlib way !include <My_Service/my_method>

To add some detail:

jar contains:

MyService1/myMethod1.iuml

MyService1/myMethod2.iuml

MyService2/myMethod3.iuml

myMethod1.iuml look like this

@startuml

  component "A" as a

  !definelong method1(CALLER)

CALLER --> a: <<uses>>

  !enddefinelng

@enduml

I'd like to have this jar or zip included via classpath or -library my.jar,my2.jar

To be able to do this:

@startuml

!include jar:MyService1/myMethod1.iuml

component "Me" as me

method1(me)

@enduml

!include jar:MyService1/myMethod1.iuml

could be also, e.g.

!include <MyService1/myMethod1.iuml>

or

!include library:MyService1/myMethod1.iuml

!include library~MyService1/myMethod1.iuml

BTW. I found this: http://forum.plantuml.net/5649/provide-a-way-to-include-multiple-files-via-command-line which looks pretty similar and provides a possibility to include a number of files via -I. However, I'd like to include files on runtime and not on startup. This would lead to a number of components/participants created that are not intended to be there. Therefore, it is more like if a specific !include is used plantuml tries to get a resource from the provided "library". If it is not there or the file is not found in the library we get the same error as if I would include a non existing file.

Does this feature already exist or does it sound interesting to implement?

BR,

Michael

1 Answer

0 votes
answered Aug 24, 2018 by plantuml (295,760 points)

Thanks for the suggestion.

In last beta http://beta.plantuml.net/plantuml.jar you can now have :

!include included.zip~file1.txt

Note that "included.zip" file has to be a local file (like any regular included file)
Does it help ?

Note that this has not been widely tested :-)

commented Aug 27, 2018 by mgrol (3,150 points)
Hi,
thank you for comming back to me.  Maybe the solution is already there and I just don't see it

Well, it helps if you include a file that does not include any other file from this "library". What I  need is somehow the option "-Dplantuml.include.path=" but for a zip/jar file. The "library" which I am working on for my purposes makes heavy use of includes, meaning I include a file that "provides" a service and includes a file with a service itself, which again includes a file with a macro and so on. Thus, I can include the first file, but this file includes also a file itself. This cannot be included as it is part of my zip/jar file but plantuml thinks this file is located in the folder.


Comming back to my example above:

MyService1/myMethod1.iuml
MyService1/myMethod2.iuml
MyService2/myMethod3.iuml

Think about myMethod1.iuml that has an
"!include ./myMethod2.iuml" which itself has an
"!includes ../MyService2/myMethod3.iuml"

All includes in my "library" have relative path because this library is used from different people that store the folder in different places. What I would like to achieve is the possibility to somehow loosely package my library with the plantuml.jar.

Side note:
What I also could think of to package a kind of manifest into this zip/jar so that plantuml can recognize the zip/jar file as a library. This could be helpfull if you use ".getClassLoader().getResource(requestedFile)" but want to check whether or not this jar/zip should be considered as a library file.

BR,
Michael

BR,
Michael
...