Class StaticWeaveAntTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class StaticWeaveAntTask
    extends org.apache.tools.ant.Task

    Description: This is the static weave ant task definition class that verifies the value of specified attributes and invokes StaticWeaveProcessor to weave classes.

    Usage:

    • Ensure the classpath contains all the classes necessary to load the classes in the source.
    • The lib containing this weaving Ant task must be added into the classpath by using the -lib option on Ant command line instead of using the classpath attribute of the taskdef Ant task.
    • Define weaving Ant task and Ant target by using following attributes:
      • source - specify source location. In the default configuration StaticWeaveAntTask assumes the source contains the persistence.xml,if this is not the case, the location containing the persistence.xml must be explicitly identified by the attribute 'persistenceinfo'.
      • target - specify the output location (either a directory or a jar).
      • persistenceinfo - specify the location containing the persistence.xml. This is optional and should only be specified if the source does not contain the persistence.xml. Weaving is not required for composite persistence unit - only for its members. If composite persistence unit member can't be used independently from its composite (specifies <property name="eclipselink.composite-unit.member" value="true"/>) then it must specify both its source and persistenceInfo of its composite. Otherwise composite persistence unit member may or may not specify persistenceInfo of its composite.
      • log - specify a logging file. This is optional.
      • loglevel - specify a literal value of EclipseLink logging level(OFF,SEVERE,WARNING,INFO,CONFIG,FINE,FINER,FINEST) The default value is OFF(8). This is optional.
    • The weaving will be performed in place if source and target point to the same location. Weaving in place is ONLY applicable for directory-based sources.
    Example:
    <target name="define.task" description="New task definition for EclipseLink static weaving"/>
      <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>
    </target>
    <target name="weaving" description="perform weaving." depends="define.task">
      <weave source= "c:\foo.jar" target = "c:\wovenfoo.jar" persistenceinfo="c:\foo-containing-persistenceinfo.jar">
        <classpath>
          <pathelement path="c:\foo-dependent.jar"/>
        </classpath>
      </weave>
    </target>
    • Field Summary

      • Fields inherited from class org.apache.tools.ant.Task

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

        description, location, project
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addClasspath​(org.apache.tools.ant.types.Path path)
      Add the dependent classpath in order to load classes from the specified input jar.
      void execute()
      Execute ant task.
      void setLog​(java.lang.String logFile)
      Set the log file.
      void setLogLevel​(java.lang.String logLevel)  
      void setPersistenceinfo​(java.lang.String persistenceinfo)  
      void setpersistencexml​(java.lang.String persistenceXMLLocation)  
      void setSource​(java.lang.String source)
      Set the input archive to be used to weave.
      void setTarget​(java.lang.String target)
      Set output archive to be used to weave to.
      • 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
    • Constructor Detail

      • StaticWeaveAntTask

        public StaticWeaveAntTask()
    • Method Detail

      • setSource

        public void setSource​(java.lang.String source)
        Set the input archive to be used to weave.
      • setTarget

        public void setTarget​(java.lang.String target)
        Set output archive to be used to weave to.
      • setLog

        public void setLog​(java.lang.String logFile)
                    throws java.io.IOException
        Set the log file.
        Throws:
        java.io.IOException
      • setLogLevel

        public void setLogLevel​(java.lang.String logLevel)
      • setPersistenceinfo

        public void setPersistenceinfo​(java.lang.String persistenceinfo)
      • setpersistencexml

        public void setpersistencexml​(java.lang.String persistenceXMLLocation)
      • addClasspath

        public void addClasspath​(org.apache.tools.ant.types.Path path)
        Add the dependent classpath in order to load classes from the specified input jar.
      • execute

        public void execute()
        Execute ant task.
        Overrides:
        execute in class org.apache.tools.ant.Task