PlantUML Dependency

Open-Source tool in Java to parse source code to automatically draw UML class Diagram using PlantUML

PlantUML Dependency Ant task

You can run PlantUML Dependency using the following simplest Ant example :

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample1" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the current directory to output "plantuml1.txt" file -->
		<target name="main">
			<plantuml-dependency output="plantuml1.txt" />
		</target>
	</project>
			

This Ant task processes all .java files of the current directory and output a plantuml1.txt text file.

Input Directory

You can also specify a input base directory to look for the .java files, using baseDir tag.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample2" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the "/home/test" directory to output "plantuml2.txt" file -->
		<target name="main">
			<plantuml-dependency output="plantuml2.txt" baseDir="/home/test" />
		</target>
	</project>
			

This Ant task processes all .java files of the /home/test directory and output a plantuml2.txt text file.

Includes and excludes files

You can also specify a set of files to include or exclude when browsing the input base directory, using includes and excludes tags.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample3" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files with the "Test" string in their names except those which have the "PlantUML" string in their names within the "/home/test" directory to output "plantuml3.txt" file -->
		<target name="main">
			<plantuml-dependency output="plantuml3.txt" baseDir="/home/test" includes="**/*Test*.java" excludes="**/PlantUML*.java" />
		</target>
	</project>
			

This Ant task processes all *Test*.java files (except those which have PlantUML in their name) of the /home/test directory and output a plantuml3.txt text file.

Verbose level

You can also specify the verbose level. The argument may consist of either a level name or an integer value. Classical values are : "SEVERE":1000, "WARNING":900, "INFO":800, "CONFIG":700, "FINE":500, "FINER":400, "FINEST":300.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample4" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the "/home/test" directory to output "plantuml4.txt" file using verbose mode -->
		<target name="main">
			<plantuml-dependency output="plantuml4.txt" baseDir="/home/test" verboseLevel="FINEST" />
		</target>
	</project>
			

This Ant task processes all .java files of the /home/test directory and output a plantuml4.txt text file using the finest verbose level.

Display types

You can also specify the display type to specify class diagram objects to display. It is a separated comma list with these possible values : [abstract_classes,annotations,classes,enums,extensions,implementations,imports,interfaces,native_methods,static_imports]. "abstract_classes" : displays parsed source files which are abstract classes and relations to abstract classes, "annotations" : displays parsed source files which are annotations, annotations (upon classes and methods) of all parsed source files and relations to annotations, "classes" : displays parsed source files which are classes (not abstract), dependencies which are considered as classes (because they are imported or extended but not parsed) and relations to classes, "enums" : displays parsed source files which are enums and relations to enums, "extensions" : displays relations between dependencies which are extended by parsed source files (i.e. classes or interfaces) if their type is displayed, "implementations" : displays relations between dependencies which are implemented by parsed source files (i.e. interfaces) if their type is displayed, "imports" : displays relations from parsed source files to import dependencies (not static) if their type is displayed, "interfaces" : displays parsed source files which are interfaces, dependencies which are considered as interfaces (because they are implemented but not parsed) and relations to interfaces, "native_methods" : displays relations from parsed source files to the native dependency if they use native methods, "static_imports" : displays relations from parsed source files to import dependencies (only static) if their type is displayed.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample5" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the "/home/test" directory to output "plantuml5.txt" file but displaying only interfaces with their relations -->
		<target name="main">
			<plantuml-dependency output="plantuml5.txt" baseDir="/home/test" displayType="implementations,interfaces,extensions,imports,static_imports" />
		</target>
	</project>
			

This Ant task processes all .java files of the /home/test directory and output a plantuml5.txt text file which contains only interfaces with their relations.

Display name

You can also specify class diagram objects to display following their name. It is a regular expression following the Java pattern (see this page for description). If not specified, the default is ".*". Note : native calls which are represented by the "NativeCall" name can also be matched by this regular expression even if it is a fictive dependency.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample6" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the "/home/test" directory to output "plantuml6.txt" file but displaying only objects matching the .*net.* package name -->
		<target name="main">
			<plantuml-dependency output="plantuml6.txt" baseDir="/home/test" displayPackageName=".*net.*" />
		</target>
	</project>
			

This Ant task processes all .java files of the /home/test directory and output a plantuml6.txt text file which contains only objects matching the .*net.* package name.

Display package name

You can also specify class diagram objects to display following their package name. It is a regular expression following the Java pattern (see this page for description). If not specified, the default is ".*". Note : native calls which are represented by the "NativeCall" name can also be matched by this regular expression even if it is a fictive dependency.

	<?xml version="1.0" encoding="UTF-8"?>
	<project name="PlantUMLDependencyAntTaskSample7" default="main" basedir=".">
		<!-- task definition -->
		<taskdef name="plantuml-dependency" classname="net.sourceforge.plantumldependency.cli.main.ant.PlantUMLDependencyProgramTask" classpath="/home/target/plantuml-dependency-cli-1.4.0-jar-with-dependencies.jar" />

		<!-- process all java files within the "/home/test" directory to output "plantuml7.txt" file but displaying only objects matching the .*a.* name -->
		<target name="main">
			<plantuml-dependency output="plantuml6.txt" baseDir="/home/test" displayName=".*a.*" />
		</target>
	</project>
			

This Ant task processes all .java files of the /home/test directory and output a plantuml4.txt text file which contains only only objects matching the .*a.* name.

Note that options are just ignored if they have empty values. For instance, the verboseLevel option doesn't behave the same as the command line.
Back to top Contact Donate Get plantuml dependency at SourceForge.net. Fast, secure and Free Open Source software downloads