[use case] Maven dependencies

Description

The Maven dependencies use case illustrates the xml task in a set2file usage : transformation of maven pom.xml files to single (plant)uml diagram.

Sample

Transform maven pom.xml to single (plant)uml diagram.

ant file - build.xml

<project name="usages" xmlns:bj="antlib:org.bidji.taskdefs">
  <target name="maven-deps" description="generate maven deps">
    <bj:xmlt tofile="gen/maven-deps.puml" template="templates/pom2plantuml.ftl" overwrite="true">
      <fileset dir="${project.dir}">
        <include name="ant4x/dev/pom.xml"/>
        <include name="bidji/dev/pom.xml"/>
      </fileset>
    </bj:xmlt>
  </target>
</project>

input file - pom.xml

<project>
  ...
  <dependencies>
    <dependency>
	  <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.8.0</version>
      <type>jar</type>
      <scope>provided</scope>
    </dependency>
    ...
  </dependencies>
  ...
</project>

pom2plantuml.ftl

Iterate over each dependency: [#foreach dependency in project.dependencies.dependency] of each pom.xml: [#foreach project in xmlset.project]

@startuml

[#foreach project in xmlset.project]
artifact ${project.artifactId}
  [#foreach dependency in project.dependencies.dependency]
    [#assign deps = dependency.artifactId?replace('.','_')?replace('-','_')]
artifact ${deps}
${project.artifactId} --* ${deps} 
  [/#foreach]
[/#foreach]

@enduml

maven-deps.puml

@startuml

artifact ant4x
artifact ant_1_8_0
ant4x --* ant_1_8_0
...

@enduml