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.
| Modifier and Type | Class and Description |
|---|---|
| public class | Rmic.ImplementationSpecificArgument
Adds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation. |
| Modifier and Type | Field and Description |
|---|---|
| private File | |
| private String | |
| private Path | |
| private Vector | |
| private boolean | |
| private File | |
| public static final String | ERROR_BASE_NOT_SET
base attribute not set 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_NOT_DEFINED
not defined message |
| public static final String | ERROR_NOT_FOUND
could not be found message |
| public static final String | ERROR_RMIC_FAILED
rmic failed message |
| public static final String | ERROR_UNABLE_TO_VERIFY_CLASS
unable to verify message |
| private String | |
| private Path | |
| private FacadeTaskHelper | |
| private static final FileUtils | |
| private boolean | |
| private boolean | |
| private String | |
| private boolean | |
| private String | |
| private boolean | |
| private boolean | |
| private boolean | |
| private AntClassLoader | |
| private RmicAdapter | |
| private File | |
| private String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| public synchronized Path | |
| public Rmic. | Returns: an object to be configured with a command line argumentAdds an implementation specific command line argument. |
| public Path | Returns: PathThe classpath to use when loading the compiler implementation if it is not a built-in one. |
| public synchronized Path | Returns: path object to be configured with the extension directoriesMaybe creates a nested extdirs element. |
| public void | execute()
Overrides org. |
| public File | Returns: the location of the compiled filesGets the base directory to output generated class. |
| public String | |
| public Path | |
| public Vector | |
| public String | |
| public String[] | Returns: array of command line arguments, guaranteed to be non-null.Get the additional implementation specific command line arguments. |
| public boolean | |
| public File | Returns: the base directory to output the generated files.Gets the base directory to output the generated files. |
| public String | Returns: StringExplicitly specified name of the executable to use when forking - if any. |
| public Path | Returns: the extension directories to be usedGets the extension directories that will be used during the compilation. |
| public Vector | |
| public boolean | |
| public boolean | |
| public String | |
| public boolean | |
| public String | |
| public boolean | Returns: true if ant's classpath is to be includedGets whether or not the ant classpath is to be included in the task's classpath. |
| public boolean | Returns: true if default run-time libraries are includedGets whether or not the java runtime should be included in this task's classpath. |
| public ClassLoader | |
| public File | Returns: the actual directory to output to (either destdir or basedir)Gets the base directory to output the generated files, favoring destdir if set, otherwise defaulting to basedir. |
| public Class | Returns: the topmost interface that extends Remote, or null if there is none.the class to be tested testClass)Returns the topmost interface that extends Remote for a given class - if one exists. |
| public File | Returns: sourceBase the directory containing the source files.Gets the source dirs to find the source java files. |
| public String | |
| public boolean | |
| public boolean | Returns: true if the class can be rmic'edthe name of the class to be tested classname)Load named class and test whether it can be rmic'ed |
| private boolean | isValidRmiRemote(Class<?> testClass)
Check to see if the class or (super)interfaces implement java.rmi.Remote. |
| private void | moveGeneratedFile(File baseDir, File sourceBaseFile, String classname, RmicAdapter adapter)
Move the generated source file(s) to the base directory |
| protected void | scanDir(File
the base direction baseDir, String[] the list of files to scan files, FileNameMapper the mapper of files to target files mapper)Scans the directory looking for class files to be compiled. |
| public void | |
| public void | setClassname(String
the name of the class for rmic to create code for classname)Sets the class to run |
| public synchronized void | setClasspath(Path
the classpath used for this compilation classpath)Set the classpath to be used for this compilation. |
| public void | setClasspathRef(Reference
the reference to add to the classpath pathRef)Adds to the classpath a reference to a <path> defined elsewhere. |
| public void | setCompiler(String
the compiler implementation to use compiler)Sets the compiler implementation to use; optional,
defaults to the value of the |
| public void | setDebug(boolean
turn on debug info debug)Generate debug info (passes -g to rmic); optional, defaults to false |
| public void | setDestdir(File
the base directory to output the generated files. destdir)Sets the base directory to output the generated files. |
| public void | |
| public synchronized void | setExtdirs(Path
the extension directories to be used extDirs)Sets the extension directories that will be used during the compilation; optional. |
| public void | |
| public void | |
| public void | |
| public void | setIiop(boolean
generate IIOP compatible stubs iiop)Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set. |
| public void | |
| public void | setIncludeantruntime(boolean
if true include ant's classpath include)Sets whether or not to include ant's own classpath in this task's classpath. |
| public void | |
| public void | setListfiles(boolean
if true list the source files list)If true, list the source files being handed off to the compiler. |
| public void | setSourceBase(File
the directory to save source files to. sourceBase)optional directory to save generated source files to. |
| public void | setStubVersion(String
the JDK version stubVersion)Specify the JDK version for the generated stub code. |
| public void | setVerify(boolean
turn on verification for classes verify)Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote. |
| baseDir | back to summary |
|---|---|
| private File baseDir | |
| classname | back to summary |
|---|---|
| private String classname | |
| compileClasspath | back to summary |
|---|---|
| private Path compileClasspath | |
| compileList | back to summary |
|---|---|
| private Vector<String> compileList | |
| debug | back to summary |
|---|---|
| private boolean debug | |
| destDir | back to summary |
|---|---|
| private File destDir | |
| ERROR_BASE_NOT_SET | back to summary |
|---|---|
| public static final String ERROR_BASE_NOT_SET base attribute not set message | |
| ERROR_LOADING_CAUSED_EXCEPTION | back to summary |
|---|---|
| public static final String ERROR_LOADING_CAUSED_EXCEPTION loaded error message | |
| ERROR_NO_BASE_EXISTS | back to summary |
|---|---|
| public static final String ERROR_NO_BASE_EXISTS base not exists message | |
| ERROR_NOT_A_DIR | back to summary |
|---|---|
| public static final String ERROR_NOT_A_DIR base not a directory message | |
| ERROR_NOT_DEFINED | back to summary |
|---|---|
| public static final String ERROR_NOT_DEFINED not defined message | |
| ERROR_NOT_FOUND | back to summary |
|---|---|
| public static final String ERROR_NOT_FOUND could not be found message | |
| ERROR_RMIC_FAILED | back to summary |
|---|---|
| public static final String ERROR_RMIC_FAILED rmic failed message | |
| ERROR_UNABLE_TO_VERIFY_CLASS | back to summary |
|---|---|
| public static final String ERROR_UNABLE_TO_VERIFY_CLASS unable to verify message | |
| executable | back to summary |
|---|---|
| private String executable | |
| extDirs | back to summary |
|---|---|
| private Path extDirs | |
| facade | back to summary |
|---|---|
| private FacadeTaskHelper facade | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS | |
| filtering | back to summary |
|---|---|
| private boolean filtering | |
| idl | back to summary |
|---|---|
| private boolean idl | |
| idlOpts | back to summary |
|---|---|
| private String idlOpts | |
| iiop | back to summary |
|---|---|
| private boolean iiop | |
| iiopOpts | back to summary |
|---|---|
| private String iiopOpts | |
| includeAntRuntime | back to summary |
|---|---|
| private boolean includeAntRuntime | |
| includeJavaRuntime | back to summary |
|---|---|
| private boolean includeJavaRuntime | |
| listFiles | back to summary |
|---|---|
| private boolean listFiles | |
| loader | back to summary |
|---|---|
| private AntClassLoader loader | |
| nestedAdapter | back to summary |
|---|---|
| private RmicAdapter nestedAdapter | |
| sourceBase | back to summary |
|---|---|
| private File sourceBase | |
| stubVersion | back to summary |
|---|---|
| private String stubVersion | |
| verify | back to summary |
|---|---|
| private boolean verify | |
| Rmic | back to summary |
|---|---|
| public Rmic() Constructor for Rmic. | |
| add | back to summary |
|---|---|
| public void add(RmicAdapter adapter) Set the compiler adapter explicitly.
| |
| cleanup | back to summary |
|---|---|
| protected void cleanup() Cleans up resources.
| |
| createClasspath | back to summary |
|---|---|
| public synchronized Path createClasspath() Creates a nested classpath element.
| |
| createCompilerArg | back to summary |
|---|---|
| public Rmic. Adds an implementation specific command line argument.
| |
| createCompilerClasspath | back to summary |
|---|---|
| public Path createCompilerClasspath() The classpath to use when loading the compiler implementation if it is not a built-in one.
| |
| createExtdirs | back to summary |
|---|---|
| public synchronized Path createExtdirs() Maybe creates a nested extdirs element.
| |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. execute by creating an instance of an implementation class and getting to do the work
| |
| getBase | back to summary |
|---|---|
| public File getBase() Gets the base directory to output generated class.
| |
| getClassname | back to summary |
|---|---|
| public String getClassname() Gets the class name to compile.
| |
| getClasspath | back to summary |
|---|---|
| public Path getClasspath() Gets the classpath.
| |
| getCompileList | back to summary |
|---|---|
| public Vector | |
| getCompiler | back to summary |
|---|---|
| public String getCompiler() get the name of the current compiler
| |
| getCurrentCompilerArgs | back to summary |
|---|---|
| public String[] getCurrentCompilerArgs() Get the additional implementation specific command line arguments.
| |
| getDebug | back to summary |
|---|---|
| public boolean getDebug() Gets the debug flag.
| |
| getDestdir | back to summary |
|---|---|
| public File getDestdir() Gets the base directory to output the generated files.
| |
| getExecutable | back to summary |
|---|---|
| public String getExecutable() Explicitly specified name of the executable to use when forking - if any.
| |
| getExtdirs | back to summary |
|---|---|
| public Path getExtdirs() Gets the extension directories that will be used during the compilation.
| |
| getFileList | back to summary |
|---|---|
| public Vector Gets file list to compile. | |
| getFiltering | back to summary |
|---|---|
| public boolean getFiltering() Gets whether token filtering is set
| |
| getIdl | back to summary |
|---|---|
| public boolean getIdl() Gets IDL flags.
| |
| getIdlopts | back to summary |
|---|---|
| public String getIdlopts() Gets additional arguments for idl compile.
| |
| getIiop | back to summary |
|---|---|
| public boolean getIiop() Gets iiop flags.
| |
| getIiopopts | back to summary |
|---|---|
| public String getIiopopts() Gets additional arguments for iiop.
| |
| getIncludeantruntime | back to summary |
|---|---|
| public boolean getIncludeantruntime() Gets whether or not the ant classpath is to be included in the task's classpath.
| |
| getIncludejavaruntime | back to summary |
|---|---|
| public boolean getIncludejavaruntime() Gets whether or not the java runtime should be included in this task's classpath.
| |
| getLoader | back to summary |
|---|---|
| public ClassLoader getLoader() Classloader for the user-specified classpath.
| |
| getOutputDir | back to summary |
|---|---|
| public File getOutputDir() Gets the base directory to output the generated files, favoring destdir if set, otherwise defaulting to basedir.
| |
| getRemoteInterface | back to summary |
|---|---|
| public Class Returns the topmost interface that extends Remote for a given class - if one exists. | |
| getSourceBase | back to summary |
|---|---|
| public File getSourceBase() Gets the source dirs to find the source java files.
| |
| getStubVersion | back to summary |
|---|---|
| public String getStubVersion() Gets the JDK version for the generated stub code.
| |
| getVerify | back to summary |
|---|---|
| public boolean getVerify() Get verify flag.
| |
| isValidRmiRemote | back to summary |
|---|---|
| public boolean isValidRmiRemote(String classname) Load named class and test whether it can be rmic'ed
| |
| isValidRmiRemote | back to summary |
|---|---|
| private boolean isValidRmiRemote(Class<?> testClass) Check to see if the class or (super)interfaces implement java.rmi.Remote. | |
| moveGeneratedFile | back to summary |
|---|---|
| private void moveGeneratedFile(File baseDir, File sourceBaseFile, String classname, RmicAdapter adapter) throws BuildException Move the generated source file(s) to the base directory
| |
| scanDir | back to summary |
|---|---|
| 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.
| |
| setBase | back to summary |
|---|---|
| public void setBase(File base) Sets the location to store the compiled files; required
| |
| setClassname | back to summary |
|---|---|
| public void setClassname(String classname) Sets the class to run
| |
| setClasspath | back to summary |
|---|---|
| public synchronized void setClasspath(Path classpath) Set the classpath to be used for this compilation.
| |
| setClasspathRef | back to summary |
|---|---|
| public void setClasspathRef(Reference pathRef) Adds to the classpath a reference to a <path> defined elsewhere.
| |
| setCompiler | back to summary |
|---|---|
| public void setCompiler(String compiler) Sets the compiler implementation to use; optional,
defaults to the value of the
| |
| setDebug | back to summary |
|---|---|
| public void setDebug(boolean debug) Generate debug info (passes -g to rmic); optional, defaults to false
| |
| setDestdir | back to summary |
|---|---|
| public void setDestdir(File destdir) Sets the base directory to output the generated files.
| |
| setExecutable | back to summary |
|---|---|
| public void setExecutable(String ex) Name of the executable to use when forking.
| |
| setExtdirs | back to summary |
|---|---|
| public synchronized void setExtdirs(Path extDirs) Sets the extension directories that will be used during the compilation; optional.
| |
| setFiltering | back to summary |
|---|---|
| public void setFiltering(boolean filter) Sets token filtering [optional], default=false
| |
| setIdl | back to summary |
|---|---|
| public void setIdl(boolean idl) Indicates that IDL output should be generated. This defaults to false if not set.
| |
| setIdlopts | back to summary |
|---|---|
| public void setIdlopts(String idlOpts) pass additional arguments for IDL compile
| |
| setIiop | back to summary |
|---|---|
| public void setIiop(boolean iiop) Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.
| |
| setIiopopts | back to summary |
|---|---|
| public void setIiopopts(String iiopOpts) Set additional arguments for iiop
| |
| setIncludeantruntime | back to summary |
|---|---|
| public void setIncludeantruntime(boolean include) Sets whether or not to include ant's own classpath in this task's
classpath.
Optional; default is
| |
| setIncludejavaruntime | back to summary |
|---|---|
| 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
| |
| setListfiles | back to summary |
|---|---|
| public void setListfiles(boolean list) If true, list the source files being handed off to the compiler.
| |
| setSourceBase | back to summary |
|---|---|
| public void setSourceBase(File sourceBase) optional directory to save generated source files to.
| |
| setStubVersion | back to summary |
|---|---|
| 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.
| |
| setVerify | back to summary |
|---|---|
| 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.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | setCompiler(String
the compiler to be used. impl)Only pass the specified argument if the chosen compiler implementation matches the value of this attribute. |
| ImplementationSpecificArgument | back to summary |
|---|---|
| public ImplementationSpecificArgument() | |
| setCompiler | back to summary |
|---|---|
| public void setCompiler(String impl) 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.)
| |