<java : Rmic>

Description

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.

Parameters

Attribute Description Type Required?
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. boolean ?
excludes String ?
iiop Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set. boolean ?
idlopts pass additional arguments for IDL compile String ?
extdirs Sets the extension directories that will be used during the compilation; optional. Path ?
sourcebase optional directory to save generated source files to. File ?
classpathref Adds to the classpath a reference to a <path> defined elsewhere. Reference ?
base Sets the location to store the compiled files; required File ?
defaultexcludes boolean ?
followsymlinks boolean ?
includeantruntime Sets whether or not to include ant's own classpath in this task's classpath. Optional; default is true. boolean ?
includejavaruntime task's classpath. Enables or disables including the default run-time libraries from the executing VM; optional, defaults to false boolean ?
classpath Set the classpath to be used for this compilation. Path ?
casesensitive boolean ?
debug Generate debug info (passes -g to rmic); optional, defaults to false boolean ?
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 String ?
includes String ?
includesfile File ?
idl Indicates that IDL output should be generated. This defaults to false if not set. boolean ?
iiopopts Set additional arguments for iiop String ?
classname Sets the class to run rmic against; optional String ?
excludesfile File ?
filtering Sets token filtering [optional], default=false boolean ?
stubversion Specify the JDK version for the generated stub code. Specify "1.1" to pass the "-v1.1" option to rmic. String ?

Parameters accepted as nested elements

<patternset> ...

Named collection of include/exclude tags.

Moved out of MatchingTask to make it a standalone object that could be referenced (by scripts for example).

Attribute Description Type Required
includes Appends includes to the current list of include patterns. Patterns may be separated by a comma or a space. String ?
refid Makes this instance in effect a reference to another PatternSet instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

Reference ?
excludesfile Sets the name of the file containing the excludes patterns. File ?
includesfile Sets the name of the file containing the includes patterns. File ?
excludes Appends excludes to the current list of exclude patterns. Patterns may be separated by a comma or a space. String ?

<exclude>

inner class to hold a name on list. "If" and "Unless" attributes may be used to invalidate the entry based on the existence of a property (typically set thru the use of the Available task).
Attribute Description Type Required
name Sets the name pattern. String ?
unless Sets the unless attribute. This attribute and the "if" attribute are used to validate the name, based in the existence of the property. String ?
if Sets the if attribute. This attribute and the "unless" attribute are used to validate the name, based in the existence of the property. String ?

<include>

inner class to hold a name on list. "If" and "Unless" attributes may be used to invalidate the entry based on the existence of a property (typically set thru the use of the Available task).
Attribute Description Type Required
name Sets the name pattern. String ?
unless Sets the unless attribute. This attribute and the "if" attribute are used to validate the name, based in the existence of the property. String ?
if Sets the if attribute. This attribute and the "unless" attribute are used to validate the name, based in the existence of the property. String ?

<custom> (Of type ExtendSelector )

Selector that selects files by forwarding the request on to other classes.
Attribute Description Type Required
classpath Set the classpath to load the classname specified using an attribute. Path ?
error String ?
classpathref Set the classpath to use for loading a custom selector by using a reference. Reference ?
refid Reference ?
classname Sets the classname of the custom selector. String ?

<present> (Of type PresentSelector )

Selector that filters files based on whether they appear in another directory tree. It can contain a mapper element, so isn't available as an ExtendSelector (since those parameters can't hold other elements).
Attribute Description Type Required
error String ?
targetdir The name of the file or directory which is checked for matching files. File ?
refid Reference ?
present This sets whether to select a file if its dest file is present. It could be a negate boolean, but by doing things this way, we get some documentation on how the system works. A user looking at the documentation should clearly understand that the ONLY files whose presence is being tested are those that already exist in the source directory, hence the lack of a destonly option. String ["srconly", "both"] ?

<none> (Of type NoneSelector )

This selector has a collection of other selectors. All of those selectors must refuse to select a file before the file is considered selected by this selector.
Attribute Description Type Required
error String ?
refid Reference ?

<extdirs> ...

This object represents a path as used by CLASSPATH or PATH environment variable.

<sometask>
  <somepath>
    <pathelement location="/path/to/file.jar" />
    <pathelement path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />
    <pathelement location="/path/to/file3.jar" />
    <pathelement location="/path/to/file4.jar" />
  </somepath>
</sometask>

The object implemention sometask must provide a method called createSomepath which returns an instance of Path. Nested path definitions are handled by the Path object and must be labeled pathelement.

The path element takes a parameter path which will be parsed and split into single elements. It will usually be used to define a path from an environment variable.

Attribute Description Type Required
refid Makes this instance in effect a reference to another Path instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

Reference ?
path Parses a path definition and creates single PathElements. String ?

<not> (Of type NotSelector )

This selector has one other selectors whose meaning it inverts. It actually relies on NoneSelector for its implementation of the isSelected() method, but it adds a check to ensure there is only one other selector contained within.
Attribute Description Type Required
error String ?
refid Reference ?

<type> (Of type TypeSelector )

Selector that selects a certain kind of file: directory or regular.
Attribute Description Type Required
error String ?
refid Reference ?
type Set the type of file to require. String ["file", "dir"] ?

<modified> (Of type ModifiedSelector )

Selector class that uses Algorithm, Cache and Comparator for its work. The Algorithm is used for computing a hashvalue for a file. The Comparator decides whether to select or not. The Cache stores the other value for comparison by the Comparator in a persistent manner.

The ModifiedSelector is implemented as a CoreSelector and uses default values for all its attributes therefore the simpliest example is

   
       
           
       
   
 

The same example rewritten as CoreSelector with setting the all values (same as defaults are) would be

   
       
           
               
               
           
       
   
 

And the same rewritten as CustomSelector would be

   
       
           
               
               
               
               
               
               
           
       
   
 

All these three examples copy the files from src to dest using the ModifiedSelector. The ModifiedSelector uses the PropertyfileCache , the DigestAlgorithm and the EqualComparator for its work. The PropertyfileCache stores key-value-pairs in a simple java properties file. The filename is cache.properties. The update flag lets the selector update the values in the cache (and on first call creates the cache). The DigestAlgorithm computes a hashvalue using the java.security.MessageDigest class with its MD5-Algorithm and its standard provider. The new computed hashvalue and the stored one are compared by the EqualComparator which returns 'true' (more correct a value not equals zero (1)) if the values are not the same using simple String comparison.

A useful scenario for this selector is inside a build environment for homepage generation (e.g. with Apache Forrest).

 
      generate the site using forrest 
     

      upload the changed files 
     
         
             
         
     
 
 
Here all changed files are uploaded to the server. The ModifiedSelector saves therefore much upload time.

This selector supports the following nested param's:

namevaluesdescriptionrequired
cache propertyfile which cache implementation should be used
  • propertyfile - using java.util.Properties
no, defaults to 'propertyfile'
algorithm hashvalue | digest which algorithm implementation should be used
  • hashvalue - loads the file content into a String and uses its hashValue() method
  • digest - uses java.security.MessageDigest class
  • no, defaults to digest
    comparator equal | role which comparator implementation should be used
  • equal - simple comparison using String.equals()
  • role - uses java.text.RuleBasedCollator class
  • no, defaults to equal
    update true | false If set to true, the cache will be stored, otherwise the values will be lost. no, defaults to true
    seldirs true | false If set to true, directories will be selected otherwise not no, defaults to true
    cache.* depends on used cache value is stored and given to the Cache-Object for initialisation depends on used cache
    algorithm.* depends on used algorithm value is stored and given to the Algorithm-Object for initialisation depends on used algorithm
    comparator.* depends on used comparator value is stored and given to the Comparator-Object for initialisation depends on used comparator
    If another name is used a BuildException "Invalid parameter" is thrown.

    This selector uses reflection for setting the values of its three interfaces (using org.apache.tools.ant.IntrospectionHelper) therefore no special 'configuration interfaces' has to be implemented by new caches, algorithms or comparators. All present setXX methods can be used. E.g. the DigestAlgorithm can use a specified provider for computing its value. For selecting this there is a setProvider(String providername) method. So you can use a nested .

    Attribute Description Type Required
    comparator String ["equal", "rule"] ?
    seldirs Support for seldirs attribute. boolean ?
    algorithm String ["hashvalue", "digest"] ?
    cache String ["propertyfile"] ?
    error String ?
    refid Reference ?
    update Support for update attribute. boolean ?

    <or> (Of type OrSelector )

    This selector has a collection of other selectors, any of which have to select a file in order for this selector to select it.
    Attribute Description Type Required
    error String ?
    refid Reference ?

    <contains> (Of type ContainsSelector )

    Selector that filters files based on whether they contain a particular string.
    Attribute Description Type Required
    error String ?
    casesensitive Whether to ignore case in the string being searched. boolean ?
    refid Reference ?
    ignorewhitespace Whether to ignore whitespace in the string being searched. boolean ?
    text The string to search for within a file. String ?

    <depend> (Of type DependSelector )

    Selector that filters files based on whether they are newer than a matching file in another directory tree. It can contain a mapper element, so isn't available as an ExtendSelector (since those parameters can't hold other elements).
    Attribute Description Type Required
    error String ?
    targetdir File ?
    refid Reference ?
    granularity int ?

    <classpath> ...

    This object represents a path as used by CLASSPATH or PATH environment variable.

    <sometask>
      <somepath>
        <pathelement location="/path/to/file.jar" />
        <pathelement path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />
        <pathelement location="/path/to/file3.jar" />
        <pathelement location="/path/to/file4.jar" />
      </somepath>
    </sometask>

    The object implemention sometask must provide a method called createSomepath which returns an instance of Path. Nested path definitions are handled by the Path object and must be labeled pathelement.

    The path element takes a parameter path which will be parsed and split into single elements. It will usually be used to define a path from an environment variable.

    Attribute Description Type Required
    refid Makes this instance in effect a reference to another Path instance.

    You must not set another attribute or nest elements inside this element if you make it a reference.

    Reference ?
    path Parses a path definition and creates single PathElements. String ?

    <different> (Of type DifferentSelector )

    This selector selects files against a mapped set of target files, selecting all those files which are different. Files with different lengths are deemed different automatically Files with identical timestamps are viewed as matching by default, unless you specify otherwise. Contents are compared if the lengths are the same and the timestamps are ignored or the same, except if you decide to ignore contents to gain speed.

    This is a useful selector to work with programs and tasks that don't handle dependency checking properly; Even if a predecessor task always creates its output files, followup tasks can be driven off copies made with a different selector, so their dependencies are driven on the absolute state of the files, not a timestamp.

    Clearly, however, bulk file comparisons is inefficient; anything that can use timestamps is to be preferred. If this selector must be used, use it over as few files as possible, perhaps following it with an <uptodate;> to keep the descendent routines conditional.

    Attribute Description Type Required
    ignorecontents This flag tells the selector to ignore contents boolean ?
    error String ?
    targetdir File ?
    refid Reference ?
    ignorefiletimes This flag tells the selector to ignore file times in the comparison boolean ?
    granularity int ?

    <size> (Of type SizeSelector )

    Selector that filters files based on their size.
    Attribute Description Type Required
    when This specifies when the file should be selected, whether it be when the file matches a particular size, when it is smaller, or whether it is larger. String ["less", "more", "equal"] ?
    units Sets the units to use for the comparison. This is a little complicated because common usage has created standards that play havoc with capitalization rules. Thus, some people will use "K" for indicating 1000's, when the SI standard calls for "k". Others have tried to introduce "K" as a multiple of 1024, but that falls down when you reach "M", since "m" is already defined as 0.001.

    To get around this complexity, a number of standards bodies have proposed the 2^10 standard, and at least one has adopted it. But we are still left with a populace that isn't clear on how capitalization should work.

    We therefore ignore capitalization as much as possible. Completely mixed case is not possible, but all upper and lower forms are accepted for all long and short forms. Since we have no need to work with the 0.001 case, this practice works here.

    This function translates all the long and short forms that a unit prefix can occur in and translates them into a single multiplier.

    String ["K", "k", "kilo", "KILO", "Ki", "KI", "ki", "kibi", "KIBI", "M", "m", "mega", "MEGA", "Mi", "MI", "mi", "mebi", "MEBI", "G", "g", "giga", "GIGA", "Gi", "GI", "gi", "gibi", "GIBI", "T", "t", "tera", "TERA", "Ti", "TI", "ti", "tebi", "TEBI"] ?
    error String ?
    refid Reference ?
    value A size selector needs to know what size to base its selecting on. This will be further modified by the multiplier to get an actual size limit. long ?

    <majority> (Of type MajoritySelector )

    This selector is here just to shake up your thinking a bit. Don't get too caught up in boolean, there are other ways you can evaluate a collection of selectors. This one takes a vote of the selectors it contains, and majority wins. You could also have an "all-but-one" selector, a "weighted-average" selector, and so on. These are left as exercises for the reader (as are the usecases where this would be necessary).
    Attribute Description Type Required
    error String ?
    refid Reference ?
    allowtie A attribute to specify what will happen if number of yes votes is the same as the number of no votes defaults to true boolean ?

    <containsregexp> (Of type ContainsRegexpSelector )

    Selector that filters files based on a regular expression.
    Attribute Description Type Required
    error String ?
    refid Reference ?
    expression The regular expression used to search the file. String ?

    <filename> (Of type FilenameSelector )

    Selector that filters files based on the filename.
    Attribute Description Type Required
    error String ?
    casesensitive Whether to ignore case when checking filenames. boolean ?
    name The name of the file, or the pattern for the name, that should be used for selection. String ?
    refid Reference ?
    negate You can optionally reverse the selection of this selector, thereby emulating an <exclude> tag, by setting the attribute negate to true. This is identical to surrounding the selector with <not></not>. boolean ?

    <selector> (Of type SelectSelector )

    This selector just holds one other selector and forwards all requests to it. It exists so that there is a single selector type that can exist outside of any targets, as an element of project. It overrides all of the reference stuff so that it works as expected. Note that this is the only selector you can reference.
    Attribute Description Type Required
    error String ?
    refid Reference ?
    unless Sets the unless attribute to a property which cannot exist for the selector to select any files. String ?
    if Sets the if attribute to a property which must exist for the selector to select any files. String ?

    <includesfile>

    inner class to hold a name on list. "If" and "Unless" attributes may be used to invalidate the entry based on the existence of a property (typically set thru the use of the Available task).
    Attribute Description Type Required
    name Sets the name pattern. String ?
    unless Sets the unless attribute. This attribute and the "if" attribute are used to validate the name, based in the existence of the property. String ?
    if Sets the if attribute. This attribute and the "unless" attribute are used to validate the name, based in the existence of the property. String ?

    <compilerarg>

    Adds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation.
    Attribute Description Type Required
    line String ?
    implementation String ?
    file File ?
    compiler Only pass the specified argument if the chosen compiler implementation matches the value of this attribute. Legal values are the same as those in the above list of valid compilers.) String ?
    pathref Reference ?
    value String ?
    path Path ?

    <date> (Of type DateSelector )

    Selector that chooses files based on their last modified date.
    Attribute Description Type Required
    refid Reference ?
    millis For users that prefer to express time in milliseconds since 1970 long ?
    checkdirs Should we be checking dates on directories? boolean ?
    datetime Sets the date. The user must supply it in MM/DD/YYYY HH:MM AM_PM format String ?
    granularity Sets the number of milliseconds leeway we will give before we consider a file not to have matched a date. int ?
    pattern Sets the pattern to be used for the SimpleDateFormat String ?
    when Sets the type of comparison to be done on the file's last modified date. String ["before", "after", "equal"] ?
    error String ?

    <excludesfile>

    inner class to hold a name on list. "If" and "Unless" attributes may be used to invalidate the entry based on the existence of a property (typically set thru the use of the Available task).
    Attribute Description Type Required
    name Sets the name pattern. String ?
    unless Sets the unless attribute. This attribute and the "if" attribute are used to validate the name, based in the existence of the property. String ?
    if Sets the if attribute. This attribute and the "unless" attribute are used to validate the name, based in the existence of the property. String ?

    <depth> (Of type DepthSelector )

    Selector that filters files based on the how deep in the directory tree they are.
    Attribute Description Type Required
    max The minimum depth below the basedir before a file is selected. int ?
    error String ?
    min The minimum depth below the basedir before a file is selected. int ?
    refid Reference ?

    <and> (Of type AndSelector )

    This selector has a collection of other selectors, all of which have to select a file in order for this selector to select it.
    Attribute Description Type Required
    error String ?
    refid Reference ?