Class JDependTask
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 
 public class JDependTask extends Task Runs JDepend tests.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 https://github.com/clarkware/jdepend. The current implementation spawn a new Java VM. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classJDependTask.FormatAttributeA class for the enumerated attribute format, values are xml and text.
 - 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description JDependTask()
 - 
Method SummaryModifier and Type Method Description PathcreateClassespath()Adds a path to class code to analyze.PathcreateClasspath()Adds a path to the classpath.PatternSet.NameEntrycreateExclude()add a name entry on the exclude listCommandline.ArgumentcreateJvmarg(CommandlineJava commandline)Create a new JVM argument.PathcreateSourcespath()Deprecated.since 1.6.x.protected ExecuteWatchdogcreateWatchdog()voidexecute()execute the taskintexecuteAsForked(CommandlineJava commandline, ExecuteWatchdog watchdog)Execute the task by forking a new JVM.intexecuteInVM(CommandlineJava commandline)Execute inside VM.PathgetClassespath()Gets the classespath.PathgetClasspath()Gets the classpath to be used for this compilation.java.io.FilegetDir()PatternSetgetExcludes()booleangetFork()booleangetHaltonerror()java.io.FilegetOutputFile()PathgetSourcespath()Deprecated.since 1.6.x.java.lang.LonggetTimeout()voidsetClasspath(Path classpath)Set the classpath to be used for this compilation.voidsetClasspathRef(Reference r)Adds a reference to a classpath defined elsewhere.voidsetDir(java.io.File dir)The directory to invoke the VM in.voidsetFork(boolean value)If true, forks into a new JVM.voidsetFormat(JDependTask.FormatAttribute ea)The format to write the output in, "xml" or "text".voidsetHaltonerror(boolean haltonerror)Whether or not to halt on failure.voidsetIncluderuntime(boolean b)If true, include jdepend.jar in the forked VM.voidsetJvm(java.lang.String value)The command used to invoke a forked Java Virtual Machine.voidsetOutputFile(java.io.File outputFile)The output file name.voidsetTimeout(java.lang.Long value)Set the timeout value (in milliseconds).- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Method Detail- 
setIncluderuntimepublic void setIncluderuntime(boolean b) If true, include jdepend.jar in the forked VM.- Parameters:
- b- include ant run time yes or no
- Since:
- Ant 1.6
 
 - 
setTimeoutpublic void setTimeout(java.lang.Long value) Set the timeout value (in milliseconds).If the operation is running for more than this value, the jdepend will be canceled. (works only when in 'fork' mode). - Parameters:
- value- the maximum time (in milliseconds) allowed before declaring the test as 'timed-out'
- See Also:
- setFork(boolean)
 
 - 
getTimeoutpublic java.lang.Long getTimeout() - Returns:
- the timeout value
 
 - 
setOutputFilepublic void setOutputFile(java.io.File outputFile) The output file name.- Parameters:
- outputFile- the output file name
 
 - 
getOutputFilepublic java.io.File getOutputFile() - Returns:
- the output file name
 
 - 
setHaltonerrorpublic void setHaltonerror(boolean haltonerror) Whether or not to halt on failure. Default: false.- Parameters:
- haltonerror- the value to set
 
 - 
getHaltonerrorpublic boolean getHaltonerror() - Returns:
- the value of the haltonerror attribute
 
 - 
setForkpublic void setFork(boolean value) If true, forks into a new JVM. Default: false.- Parameters:
- value-- trueif a JVM should be forked, otherwise- false
 
 - 
getForkpublic boolean getFork() - Returns:
- the value of the fork attribute
 
 - 
setJvmpublic void setJvm(java.lang.String value) The command used to invoke a forked Java Virtual Machine. Default isjava. Ignored if no JVM is forked.- Parameters:
- value- the new VM to use instead of- java
- See Also:
- setFork(boolean)
 
 - 
createSourcespath@Deprecated public Path createSourcespath() Deprecated.since 1.6.x.Adds a path to source code to analyze.- Returns:
- a source path
 
 - 
getSourcespath@Deprecated public Path getSourcespath() Deprecated.since 1.6.x.Gets the sourcepath.- Returns:
- the sources path
 
 - 
createClassespathpublic Path createClassespath() Adds a path to class code to analyze.- Returns:
- a classes path
 
 - 
getClassespathpublic Path getClassespath() Gets the classespath.- Returns:
- the classes path
 
 - 
setDirpublic void setDir(java.io.File dir) The directory to invoke the VM in. Ignored if no JVM is forked.- Parameters:
- dir- the directory to invoke the JVM from.
- See Also:
- setFork(boolean)
 
 - 
getDirpublic java.io.File getDir() - Returns:
- the dir attribute
 
 - 
setClasspathpublic void setClasspath(Path classpath) Set the classpath to be used for this compilation.- Parameters:
- classpath- a class path to be used
 
 - 
getClasspathpublic Path getClasspath() Gets the classpath to be used for this compilation.- Returns:
- the class path used for compilation
 
 - 
createClasspathpublic Path createClasspath() Adds a path to the classpath.- Returns:
- a classpath
 
 - 
createJvmargpublic Commandline.Argument createJvmarg(CommandlineJava commandline) Create a new JVM argument. Ignored if no JVM is forked.- Parameters:
- commandline- the commandline to create the argument on
- Returns:
- create a new JVM argument so that any argument can be passed to the JVM.
- See Also:
- setFork(boolean)
 
 - 
setClasspathRefpublic void setClasspathRef(Reference r) Adds a reference to a classpath defined elsewhere.- Parameters:
- r- a classpath reference
 
 - 
createExcludepublic PatternSet.NameEntry createExclude() add a name entry on the exclude list- Returns:
- a pattern for the excludes
 
 - 
getExcludespublic PatternSet getExcludes() - Returns:
- the excludes patterns
 
 - 
setFormatpublic void setFormat(JDependTask.FormatAttribute ea) The format to write the output in, "xml" or "text".- Parameters:
- ea- xml or text
 
 - 
executepublic void execute() throws BuildExceptionexecute the task- Overrides:
- executein class- Task
- Throws:
- BuildException- if an error occurs
 
 - 
executeInVMpublic int executeInVM(CommandlineJava commandline) throws BuildException Execute inside VM.- Parameters:
- commandline- the command line
- Returns:
- the return value of the mvm
- Throws:
- BuildException- if an error occurs
 
 - 
executeAsForkedpublic int executeAsForked(CommandlineJava commandline, ExecuteWatchdog watchdog) throws BuildException Execute the task by forking a new JVM. The command will block until it finishes. To know if the process was destroyed or not, use thekilledProcess()method of the watchdog class.- Parameters:
- commandline- the commandline for forked jvm
- watchdog- the watchdog in charge of cancelling the test if it exceeds a certain amount of time. Can be- null.
- Returns:
- the result of running the jdepend
- Throws:
- BuildException- in case of error
 
 - 
createWatchdogprotected ExecuteWatchdog createWatchdog() throws BuildException - Returns:
- nullif there is a timeout value, otherwise the watchdog instance.
- Throws:
- BuildException- in case of error
 
 
- 
 
-