Search code examples
plantuml

How can I exclude packages with Plant UML yaml


I'm attempting to make a component diagram with PlantUML. The problem I have is that I want my "common" component to include the set of packages, that include 'common'

package "Common Layer" {
  [Common] <<..common..>>
  [Something] <<com.xxx.yyy.common.somepkgs>>
}

imagine I have a class com.xxx.yyy.common.somepkgs.Something

but, because 'Something' is also 'common', this is leading to problems elsewhere. Ideally, I would like to describe my common layer as including all packages containing 'common', except com.xxx.yyy.common.somepkgs, which will be treated separately, as a different component called Something, The problem seems to be that when the diagram is being rendered; it thinks that Something belongs to two different components.


Solution

  • I didn't realize how to exclude certain sub-packages, inside puml. Instead I reorganized my packages structure.

    package "Common Layer" {
     [SomethingCommon] <<..common.something..>>
     [Something] <<com.xxx.yyy.common.somepkgs>>
    }
    

    I then replaced all references with both, instead of only one component reference. As follows:

    [somethingElse] --> [Common]
    

    became:

    [somethingElse] --> [SomethingCommon]
    [somethingElse] --> [Something]