Save This Page
Home » apache-ant-1.8.1 » org.apache.tools » ant » taskdefs » [javadoc | source]
org.apache.tools.ant.taskdefs
public class: Rmic [javadoc | source]
java.lang.Object
   org.apache.tools.ant.ProjectComponent
      org.apache.tools.ant.Task
         org.apache.tools.ant.taskdefs.MatchingTask
            org.apache.tools.ant.taskdefs.Rmic

All Implemented Interfaces:
    SelectorContainer, Cloneable

Runs the rmic compiler against classes.

Rmic can be run on a single class (as specified with the classname attribute) or a number of classes at once (all classes below base that are neither _Stub nor _Skel classes). If you want to rmic a single class and this class is a class nested into another class, you have to specify the classname in the form Outer$$Inner instead of Outer.Inner.

It is possible to refine the set of files that are being rmiced. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task forms an implicit FileSet and supports all attributes of <fileset> (dir becomes base) as well as the nested <include>, <exclude> and <patternset> elements.

It is possible to use different compilers. This can be selected with the "build.rmic" property or the compiler attribute. There are three choices:

The miniRMI project contains a compiler implementation for this task as well, please consult miniRMI's documentation to learn how to use it.

Nested Class Summary:
public class  Rmic.ImplementationSpecificArgument  Adds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation. 
Field Summary
public static final  String ERROR_RMIC_FAILED    rmic failed message 
public static final  String ERROR_UNABLE_TO_VERIFY_CLASS    unable to verify message 
public static final  String ERROR_NOT_FOUND    could not be found message 
public static final  String ERROR_NOT_DEFINED    not defined message 
public static final  String ERROR_LOADING_CAUSED_EXCEPTION    loaded error message 
public static final  String ERROR_NO_BASE_EXISTS    base not exists message 
public static final  String ERROR_NOT_A_DIR    base not a directory message 
public static final  String ERROR_BASE_NOT_SET    base attribute not set message 
Fields inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset
Fields inherited from org.apache.tools.ant.Task:
target,  taskName,  taskType,  wrapper
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
Constructor:
 public Rmic() 
Method from org.apache.tools.ant.taskdefs.Rmic Summary:
add,   cleanup,   createClasspath,   createCompilerArg,   createCompilerClasspath,   createExtdirs,   execute,   getBase,   getClassname,   getClasspath,   getCompileList,   getCompiler,   getCurrentCompilerArgs,   getDebug,   getDestdir,   getExecutable,   getExtdirs,   getFileList,   getFiltering,   getIdl,   getIdlopts,   getIiop,   getIiopopts,   getIncludeantruntime,   getIncludejavaruntime,   getLoader,   getOutputDir,   getRemoteInterface,   getSourceBase,   getStubVersion,   getVerify,   isValidRmiRemote,   scanDir,   setBase,   setClassname,   setClasspath,   setClasspathRef,   setCompiler,   setDebug,   setDestdir,   setExecutable,   setExtdirs,   setFiltering,   setIdl,   setIdlopts,   setIiop,   setIiopopts,   setIncludeantruntime,   setIncludejavaruntime,   setListfiles,   setSourceBase,   setStubVersion,   setVerify
Methods from org.apache.tools.ant.taskdefs.MatchingTask:
XsetIgnore,   XsetItems,   add,   addAnd,   addContains,   addContainsRegexp,   addCustom,   addDate,   addDepend,   addDepth,   addDifferent,   addFilename,   addMajority,   addModified,   addNone,   addNot,   addOr,   addPresent,   addSelector,   addSize,   addType,   appendSelector,   createExclude,   createExcludesFile,   createInclude,   createIncludesFile,   createPatternSet,   getDirectoryScanner,   getImplicitFileSet,   getSelectors,   hasSelectors,   selectorCount,   selectorElements,   setCaseSensitive,   setDefaultexcludes,   setExcludes,   setExcludesfile,   setFollowSymlinks,   setIncludes,   setIncludesfile,   setProject
Methods from org.apache.tools.ant.Task:
bindToOwner,   execute,   getOwningTarget,   getRuntimeConfigurableWrapper,   getTaskName,   getTaskType,   getWrapper,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   init,   isInvalid,   log,   log,   log,   log,   markInvalid,   maybeConfigure,   perform,   reconfigure,   setOwningTarget,   setRuntimeConfigurableWrapper,   setTaskName,   setTaskType
Methods from org.apache.tools.ant.ProjectComponent:
clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.taskdefs.Rmic Detail:
 public  void add(RmicAdapter adapter) 
    Set the compiler adapter explicitly.
 protected  void cleanup() 
    Cleans up resources.
 public synchronized Path createClasspath() 
    Creates a nested classpath element.
 public ImplementationSpecificArgument createCompilerArg() 
    Adds an implementation specific command line argument.
 public Path createCompilerClasspath() 
    The classpath to use when loading the compiler implementation if it is not a built-in one.
 public synchronized Path createExtdirs() 
    Maybe creates a nested extdirs element.
 public  void execute() throws BuildException 
    execute by creating an instance of an implementation class and getting to do the work
 public File getBase() 
    Gets the base directory to output generated class.
 public String getClassname() 
    Gets the class name to compile.
 public Path getClasspath() 
    Gets the classpath.
 public Vector getCompileList() 
 public String getCompiler() 
    get the name of the current compiler
 public String[] getCurrentCompilerArgs() 
    Get the additional implementation specific command line arguments.
 public boolean getDebug() 
    Gets the debug flag.
 public File getDestdir() 
    Gets the base directory to output the generated files.
 public String getExecutable() 
    Explicitly specified name of the executable to use when forking - if any.
 public Path getExtdirs() 
    Gets the extension directories that will be used during the compilation.
 public Vector getFileList() 
    Gets file list to compile.
 public boolean getFiltering() 
    Gets whether token filtering is set
 public boolean getIdl() 
    Gets IDL flags.
 public String getIdlopts() 
    Gets additional arguments for idl compile.
 public boolean getIiop() 
    Gets iiop flags.
 public String getIiopopts() 
    Gets additional arguments for iiop.
 public boolean getIncludeantruntime() 
    Gets whether or not the ant classpath is to be included in the task's classpath.
 public boolean getIncludejavaruntime() 
    Gets whether or not the java runtime should be included in this task's classpath.
 public ClassLoader getLoader() 
    Classloader for the user-specified classpath.
 public File getOutputDir() 
    Gets the base directory to output the generated files, favoring destdir if set, otherwise defaulting to basedir.
 public Class getRemoteInterface(Class testClass) 
    Returns the topmost interface that extends Remote for a given class - if one exists.
 public File getSourceBase() 
    Gets the source dirs to find the source java files.
 public String getStubVersion() 
    Gets the JDK version for the generated stub code.
 public boolean getVerify() 
    Get verify flag.
 public boolean isValidRmiRemote(String classname) 
    Load named class and test whether it can be rmic'ed
 protected  void scanDir(File baseDir,
    String[] files,
    FileNameMapper mapper) 
    Scans the directory looking for class files to be compiled. The result is returned in the class variable compileList.
 public  void setBase(File base) 
    Sets the location to store the compiled files; required
 public  void setClassname(String classname) 
    Sets the class to run rmic against; optional
 public synchronized  void setClasspath(Path classpath) 
    Set the classpath to be used for this compilation.
 public  void setClasspathRef(Reference pathRef) 
    Adds to the classpath a reference to a <path> defined elsewhere.
 public  void setCompiler(String compiler) 
    Sets the compiler implementation to use; optional, defaults to the value of the build.rmic property, or failing that, default compiler for the current VM
 public  void setDebug(boolean debug) 
    Generate debug info (passes -g to rmic); optional, defaults to false
 public  void setDestdir(File destdir) 
    Sets the base directory to output the generated files.
 public  void setExecutable(String ex) 
    Name of the executable to use when forking.
 public synchronized  void setExtdirs(Path extDirs) 
    Sets the extension directories that will be used during the compilation; optional.
 public  void setFiltering(boolean filter) 
    Sets token filtering [optional], default=false
 public  void setIdl(boolean idl) 
    Indicates that IDL output should be generated. This defaults to false if not set.
 public  void setIdlopts(String idlOpts) 
    pass additional arguments for IDL compile
 public  void setIiop(boolean iiop) 
    Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.
 public  void setIiopopts(String iiopOpts) 
    Set additional arguments for iiop
 public  void setIncludeantruntime(boolean include) 
    Sets whether or not to include ant's own classpath in this task's classpath. Optional; default is true.
 public  void setIncludejavaruntime(boolean include) 
    task's classpath. Enables or disables including the default run-time libraries from the executing VM; optional, defaults to false
 public  void setListfiles(boolean list) 
    If true, list the source files being handed off to the compiler.
 public  void setSourceBase(File sourceBase) 
    optional directory to save generated source files to.
 public  void setStubVersion(String stubVersion) 
    Specify the JDK version for the generated stub code. Specify "1.1" to pass the "-v1.1" option to rmic.
 public  void setVerify(boolean verify) 
    Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote. optional; This defaults to false if not set.