Class JarDiffTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class JarDiffTask
    extends org.apache.tools.ant.Task
    Process two jarfiles generating a public API difference report. This is useful for keeping track of API changes between versions of a project.
    Author:
    Antony Riley
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean force
      Force output, even if the existing output is newer than the jar files.
      private java.io.File fromJar
      The jarfile this diff is from.
      private java.lang.String fromName
      The name to use for the from version.
      private java.io.File out
      The file to write the report to.
      private java.io.File toJar
      The jarfile this diff is to.
      private java.lang.String toName
      The name to use for the to verison.
      • Fields inherited from class org.apache.tools.ant.Task

        target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      JarDiffTask()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()
      Run the task, generating the jardiff report.
      void setForce​(boolean force)
      Force output even if there is an existing diff file which is newer than the source jar files.
      void setFromjar​(java.io.File fromJar)
      Set the from jar file.
      void setFromname​(java.lang.String fromName)
      Set the from jar visible name.
      void setOut​(java.io.File out)
      Set the out file.
      void setTojar​(java.io.File toJar)
      Set the to jar file.
      void setToname​(java.lang.String toName)
      Set the to jar visible name.
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, 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.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fromJar

        private java.io.File fromJar
        The jarfile this diff is from.
      • toJar

        private java.io.File toJar
        The jarfile this diff is to.
      • out

        private java.io.File out
        The file to write the report to.
      • fromName

        private java.lang.String fromName
        The name to use for the from version.
      • toName

        private java.lang.String toName
        The name to use for the to verison.
      • force

        private boolean force
        Force output, even if the existing output is newer than the jar files.
    • Constructor Detail

      • JarDiffTask

        public JarDiffTask()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Run the task, generating the jardiff report.
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException - When there is an error creating the diff, When there is a problem with the xml parser, When there is a problem with the xslt transformer When the attributes specified are invalid.
      • setFromjar

        public void setFromjar​(java.io.File fromJar)
        Set the from jar file. Required attribute.
        Parameters:
        fromJar - a jar file.
      • setTojar

        public void setTojar​(java.io.File toJar)
        Set the to jar file. Required attribute.
        Parameters:
        toJar - a jar file.
      • setOut

        public void setOut​(java.io.File out)
        Set the out file. Required attribute.
        Parameters:
        out - an output file.
      • setFromname

        public void setFromname​(java.lang.String fromName)
        Set the from jar visible name. Optional attribute. Defaults to the filename of fromjar.
        Parameters:
        fromName - a visible name.
      • setToname

        public void setToname​(java.lang.String toName)
        Set the to jar visible name. Optional attribute. Defaults to the filename of tojar.
        Parameters:
        toName - a visible name.
      • setForce

        public void setForce​(boolean force)
        Force output even if there is an existing diff file which is newer than the source jar files. Optional attribute. Defaults to false.
        Parameters:
        force - true to force output, false otherwise