|
1.2 Dependency CheckerClassycle's Dependency Checker can be used as a command-line tool and as an Ant Task.1.2 Command Line ToolAnalyser is called from the command line as follows:
java -cp classycle.jar classycle.dependency.DependencyChecker \
[-mergeInnerClasses] \
[-includingClasses=<pattern1>[,<pattern2>,...]] \
[-excludingClasses=<pattern1>[,<pattern2>,...]] \
[-reflectionPattern=[<pattern1>,<pattern2>,...]] \
[-renderer=<fully qualified class name>] \
-dependencies=<description>|@<description file> \
<class files, zip/jar/war/ear files, or folders>
The argument is a list of sources for class files to be analyzed:
The options have the following meaning:
1.2.2 Ant TaskThe ant task works similar as the ant task for Analyser. Here is a simple example showing its usage:
<project name="DependencyCheckingTaskTest" default="test"
basedir="temporaryTestDirectory">
<property name="package" value="classycle"/>>
<target name="test">
<taskdef name="classycleDependencyCheck"
classname="classycle.ant.DependencyCheckingTask"/>
<classycleDependencyCheck failOnUnwantedDependencies="true"
excludingClasses="*Test,*.All*Tests">
<fileset dir="../classes">
<include name="**/*.class"/>
</fileset>
show allResults
[util] = ${package}.util.*
[notUtil] = ${package}.A* excluding [util]
check [util] independentOf [notUtil]
check [notUtil] independentOf [util]
</classycleDependencyCheck>
</target>
</project>
The source of class files can be specified by filesets and zipfilesets.
The dependency definitions commands (red lines) are embedded in the task.
For their syntax see section 4. Instead of embedding
one can also specify a dependency definition file with the attribute
definitionFile. All embedded definition commands will be ignored
if this attribute is specified.
For the attributes and their meaning see the API documentation of
DependencyCheckingTask.
Running this example build file on the console yields
Buildfile: dependencyCheckingTaskTestBuild.xml
test:
[classycleDependencyCheck] show onlyShortestPaths allResults
[classycleDependencyCheck] check [util] independentOf [notUtil] OK
[classycleDependencyCheck] check [notUtil] independentOf [util]
[classycleDependencyCheck] Dependency found:
[classycleDependencyCheck] classycle.AnalyserCommandLine
[classycleDependencyCheck] -> classycle.CommandLine
[classycleDependencyCheck] -> classycle.util.StringPatternSequence
[classycleDependencyCheck] -> classycle.util.StringPattern
[classycleDependencyCheck] -> classycle.util.AndStringPattern
[classycleDependencyCheck] -> classycle.util.WildCardPattern
[classycleDependencyCheck] -> classycle.util.NotStringPattern
[classycleDependencyCheck] -> classycle.util.TrueStringPattern
[classycleDependencyCheck] classycle.Analyser
[classycleDependencyCheck] -> classycle.util.StringPattern
[classycleDependencyCheck] -> classycle.util.TrueStringPattern
[classycleDependencyCheck] -> classycle.util.Text
BUILD FAILED
/home/fj/dev/Classycle/dependencyCheckingTaskTestBuild.xml:8:
Unwanted dependencies found. See output for details.
Total time: 2 seconds
|
|
(C) 2003-2011 Franz-Josef Elmer. All rights reserved. Last modified: 9/9/2012 |
|