Skip to content

Instantly share code, notes, and snippets.

@stoerr
Created September 29, 2014 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoerr/0406282aedbb8c7a6a52 to your computer and use it in GitHub Desktop.
Save stoerr/0406282aedbb8c7a6a52 to your computer and use it in GitHub Desktop.
Prints dependencies of a multi module maven project as graph in dotty / graphviz format
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pom="http://maven.apache.org/POM/4.0.0">
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
<!--
Generiert Fragment von dotty-File für die Pom-Abhängigkeiten.
Anwendung:
(
echo "digraph PomDependencies {"
find . -name pom.xml | xargs xsltproc pom2dotty.xslt | sort -u
echo "}"
) | tred > poms.dotty
Danach Filterung Plot mit GvEdit
-->
<xsl:template match="/">
<xsl:for-each select="/pom:project/pom:dependencies/pom:dependency">
<xsl:if test="pom:groupId = 'net.stoerr'">
<xsl:choose>
<xsl:when test="pom:scope = 'compile'">
&quot;<xsl:value-of select="/pom:project/pom:artifactId"/>&quot; -> &quot;<xsl:value-of select="pom:artifactId"/>&quot; ;<xsl:text>
</xsl:text>
</xsl:when>
<xsl:when test="pom:scope">
</xsl:when>
<xsl:otherwise>
&quot;<xsl:value-of select="/pom:project/pom:artifactId"/>&quot; -> &quot;<xsl:value-of select="pom:artifactId"/>&quot; ;<xsl:text>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment