For the purposes of a UML Package Diagram should each package in Java be considered a package? In Java each "package" is essentially a namespace and you can have two different classes (eg A
& B
) both in the same Java package (eg com.example.my
) but in different JARs (eg. API
& Domain
):
Are Java packages the same thing as packages in UML within the context of a Package Diagram? If not, what is the definition of a package in UML?
Rahman has given a good answer already. One thing I would like to mention, is that UML is programming-language and platform independent. So both definitions of a package are not the same.
An UML package can contain jar files, (as can be seen your example) but it can also contain devices, execution environments and so on.