public class JDependTask extends Task
JDepend is a tool to generate design quality metrics for each Java package. It has been initially created by Mike Clark. JDepend can be found at http://www.clarkware.com/software/JDepend.html. The current implementation spawn a new Java VM.
Modifier and Type | Class and Description |
---|---|
static class |
JDependTask.FormatAttribute
A class for the enumerated attribute format,
values are xml and text.
|
description, location, project
Constructor and Description |
---|
JDependTask() |
Modifier and Type | Method and Description |
---|---|
Path |
createClassespath()
Adds a path to class code to analyze.
|
Path |
createClasspath()
Adds a path to the classpath.
|
PatternSet.NameEntry |
createExclude()
add a name entry on the exclude list
|
Commandline.Argument |
createJvmarg(CommandlineJava commandline)
Create a new JVM argument.
|
Path |
createSourcespath()
Deprecated.
since 1.6.x.
|
protected ExecuteWatchdog |
createWatchdog() |
void |
execute()
execute the task
|
int |
executeAsForked(CommandlineJava commandline,
ExecuteWatchdog watchdog)
Execute the task by forking a new JVM.
|
int |
executeInVM(CommandlineJava commandline)
Execute inside VM.
|
Path |
getClassespath()
Gets the classespath.
|
Path |
getClasspath()
Gets the classpath to be used for this compilation.
|
java.io.File |
getDir() |
PatternSet |
getExcludes() |
boolean |
getFork() |
boolean |
getHaltonerror() |
java.io.File |
getOutputFile() |
Path |
getSourcespath()
Deprecated.
since 1.6.x.
|
java.lang.Long |
getTimeout() |
void |
setClasspath(Path classpath)
Set the classpath to be used for this compilation.
|
void |
setClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.
|
void |
setDir(java.io.File dir)
The directory to invoke the VM in.
|
void |
setFork(boolean value)
If true, forks into a new JVM.
|
void |
setFormat(JDependTask.FormatAttribute ea)
The format to write the output in, "xml" or "text".
|
void |
setHaltonerror(boolean haltonerror)
Whether or not to halt on failure.
|
void |
setIncluderuntime(boolean b)
If true,
include jdepend.jar in the forked VM.
|
void |
setJvm(java.lang.String value)
The command used to invoke a forked Java Virtual Machine.
|
void |
setOutputFile(java.io.File outputFile)
The output file name.
|
void |
setTimeout(java.lang.Long value)
Set the timeout value (in milliseconds).
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public void setIncluderuntime(boolean b)
b
- include ant run time yes or nopublic void setTimeout(java.lang.Long value)
If the operation is running for more than this value, the jdepend will be canceled. (works only when in 'fork' mode).
value
- the maximum time (in milliseconds) allowed before
declaring the test as 'timed-out'setFork(boolean)
public java.lang.Long getTimeout()
public void setOutputFile(java.io.File outputFile)
outputFile
- the output file namepublic java.io.File getOutputFile()
public void setHaltonerror(boolean haltonerror)
haltonerror
- the value to setpublic boolean getHaltonerror()
public void setFork(boolean value)
value
- true if a JVM should be forked,
otherwise falsepublic boolean getFork()
public void setJvm(java.lang.String value)
value
- the new VM to use instead of javasetFork(boolean)
public Path createSourcespath()
public Path getSourcespath()
public Path createClassespath()
public Path getClassespath()
public void setDir(java.io.File dir)
dir
- the directory to invoke the JVM from.setFork(boolean)
public java.io.File getDir()
public void setClasspath(Path classpath)
classpath
- a class path to be usedpublic Path getClasspath()
public Path createClasspath()
public Commandline.Argument createJvmarg(CommandlineJava commandline)
commandline
- the commandline to create the argument onsetFork(boolean)
public void setClasspathRef(Reference r)
r
- a classpath referencepublic PatternSet.NameEntry createExclude()
public PatternSet getExcludes()
public void setFormat(JDependTask.FormatAttribute ea)
ea
- xml or textpublic void execute() throws BuildException
execute
in class Task
BuildException
- if an error occurspublic int executeInVM(CommandlineJava commandline) throws BuildException
commandline
- the command lineBuildException
- if an error occurspublic int executeAsForked(CommandlineJava commandline, ExecuteWatchdog watchdog) throws BuildException
commandline
- the commandline for forked jvmwatchdog
- the watchdog in charge of cancelling the test if it
exceeds a certain amount of time. Can be null.BuildException
- in case of errorprotected ExecuteWatchdog createWatchdog() throws BuildException
BuildException
- in case of error