Class Jmod
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.modules.Jmod
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 
 public class Jmod extends Task Creates a linkable .jmod file from a modular jar file, and optionally from other resource files such as native libraries and documents. Equivalent to the JDK's jmod tool.Supported attributes: - destFile
- Required, jmod file to create.
- classpath- classpathref
- Where to locate files to be placed in the jmod file.
- modulepath- modulepathref
- Where to locate dependencies.
- commandpath- commandpathref
- Directories containing native commands to include in jmod.
- headerpath- headerpathref
- Directories containing header files to include in jmod.
- configpath- configpathref
- Directories containing user-editable configuration files to include in jmod.
- legalpath- legalpathref
- Directories containing legal licenses and notices to include in jmod.
- nativelibpath- nativelibpathref
- Directories containing native libraries to include in jmod.
- manpath- manpathref
- Directories containing man pages to include in jmod.
- version
- Module version.
- mainclass
- Main class of module.
- platform
- The target platform for the jmod.  A particular JDK's platform
 can be seen by running
 jmod describe $JDK_HOME/jmods/java.base.jmod | grep -i platform.
- hashModulesPattern
- Regular expression for names of modules in the module path which depend on the jmod being created, and which should have hashes generated for them and included in the new jmod.
- resolveByDefault
- Boolean indicating whether the jmod should be one of the default resolved modules in an application. Default is true.
- moduleWarnings
- Whether to emit warnings when resolving modules which are
     not recommended for use.  Comma-separated list of one of more of
     the following:
     - deprecated
- Warn if module is deprecated
- leaving
- Warn if module is deprecated for removal
- incubating
- Warn if module is an incubating (not yet official) module
 
 Supported nested elements: - <classpath>
- Path indicating where to locate files to be placed in the jmod file.
- <modulepath>
- Path indicating where to locate dependencies.
- <commandpath>
- Path of directories containing native commands to include in jmod.
- <headerpath>
- Path of directories containing header files to include in jmod.
- <configpath>
- Path of directories containing user-editable configuration files to include in jmod.
- <legalpath>
- Path of directories containing legal notices to include in jmod.
- <nativelibpath>
- Path of directories containing native libraries to include in jmod.
- <manpath>
- Path of directories containing man pages to include in jmod.
- <version>
- Module version of jmod.
     Must have a required numberattribute. May also have optionalpreReleaseandbuildattributes.
- <moduleWarning>
- Has one required attribute, reason. SeemoduleWarningsattribute above. This element may be specified multiple times.
 destFile and classpath are required data. - Since:
- 1.10.6
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classJmod.ResolutionWarningReasonPermissible reasons for jmod creation to emit warnings.classJmod.ResolutionWarningSpecChild element which enables jmod tool warnings.
 - 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description Jmod()
 - 
Method SummaryModifier and Type Method Description PathcreateClasspath()Adds an unconfigured<classpath>child element which can specify the files which will comprise the created jmod.PathcreateCommandPath()Creates a child element which can contain a list of directories containing native executable files to include in the created jmod.PathcreateConfigPath()Creates a child element which can contain a list of directories containing user configuration files to include in the created jmod.PathcreateHeaderPath()Creates a child element which can contain a list of directories containing compile-time header files for third party use, to include in the created jmod.PathcreateLegalPath()Creates a child element which can contain a list of directories containing license files to include in the created jmod.PathcreateManPath()Creates a child element which can contain a list of directories containing man pages (program manuals, typically in troff format) to include in the created jmod.PathcreateModulePath()Creates a child<modulePath>element which can contain a path of directories containing modules upon which modules in the classpath depend.Jmod.ResolutionWarningSpeccreateModuleWarning()Creates a child element which can specify the circumstances under which jmod creation emits warnings.PathcreateNativeLibPath()Creates a child element which can contain a list of directories containing native libraries to include in the created jmod.ModuleVersioncreateVersion()Creates an uninitialized child element representing the version of the module represented by the created jmod.voidexecute()Creates a jmod file according to this task's properties and child elements.PathgetClasspath()Attribute which specifies the files (usually modular .jar files) which will comprise the created jmod file.PathgetCommandPath()Attribute containing path of directories which contain native executable files to include in the created jmod.PathgetConfigPath()Attribute containing list of directories which contain user configuration files.java.io.FilegetDestFile()Attribute containing the location of the jmod file to create.java.lang.StringgetHashModulesPattern()Attribute containing a regular expression which specifies which of the modules that depend on the jmod being created should have hashes generated and added to the jmod.PathgetHeaderPath()Attribute containing a path of directories which hold compile-time header files for third party use, all of which will be included in the created jmod.PathgetLegalPath()Attribute containing list of directories which hold license files to include in the created jmod.java.lang.StringgetMainClass()Attribute containing the class that acts as the executable entry point of the created jmod.PathgetManPath()Attribute containing list of directories containing man pages to include in created jmod.PathgetModulePath()Attribute containing path of directories which contain modules on which the created jmod's constituent modules depend.PathgetNativeLibPath()Attribute containing list of directories which hold native libraries to include in the created jmod.java.lang.StringgetPlatform()Attribute containing the platform for which the jmod will be built.booleangetResolveByDefault()Attribute indicating whether the created jmod should be visible in a module path, even when not specified explicitly.java.lang.StringgetVersion()Attribute which specifies a module version for created jmod.voidsetClasspath(Path path)Sets attribute specifying the files that will comprise the created jmod file.voidsetClasspathRef(Reference ref)Sets classpath attribute from a path reference.voidsetCommandPath(Path path)Sets attribute containing path of directories which contain native executable files to include in the created jmod.voidsetCommandPathRef(Reference ref)Sets command path from a path reference.voidsetConfigPath(Path path)Sets attribute containing list of directories which contain user configuration files.voidsetConfigPathRef(Reference ref)Sets configuration file path from a path reference.voidsetDestFile(java.io.File file)Sets attribute containing the location of the jmod file to create.voidsetHashModulesPattern(java.lang.String pattern)Sets attribute containing a regular expression which specifies which of the modules that depend on the jmod being created should have hashes generated and added to the jmod.voidsetHeaderPath(Path path)Sets attribute containing a path of directories which hold compile-time header files for third party use, all of which will be included in the created jmod.voidsetHeaderPathRef(Reference ref)Sets header path from a path reference.voidsetLegalPath(Path path)Sets attribute containing list of directories which hold license files to include in the created jmod.voidsetLegalPathRef(Reference ref)Sets legal licenses path from a path reference.voidsetMainClass(java.lang.String className)Sets attribute containing the class that acts as the executable entry point of the created jmod.voidsetManPath(Path path)Sets attribute containing list of directories containing man pages to include in created jmod.voidsetManPathRef(Reference ref)Sets man pages path from a path reference.voidsetModulePath(Path path)Sets attribute containing path of directories which contain modules on which the created jmod's constituent modules depend.voidsetModulePathRef(Reference ref)Sets module path from a path reference.voidsetModuleWarnings(java.lang.String warningList)Sets attribute containing a comma-separated list of reasons for jmod creation to emit warnings.voidsetNativeLibPath(Path path)Sets attribute containing list of directories which hold native libraries to include in the created jmod.voidsetNativeLibPathRef(Reference ref)Sets native library path from a path reference.voidsetPlatform(java.lang.String platform)Sets attribute containing the platform for which the jmod will be built.voidsetResolveByDefault(boolean resolve)Sets attribute indicating whether the created jmod should be visible in a module path, even when not specified explicitly.voidsetVersion(java.lang.String version)Sets the module version for the created jmod.- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, 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.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Method Detail- 
getDestFilepublic java.io.File getDestFile() Attribute containing the location of the jmod file to create.- Returns:
- location of jmod file
- See Also:
- setDestFile(File)
 
 - 
setDestFilepublic void setDestFile(java.io.File file) Sets attribute containing the location of the jmod file to create. This value is required.- Parameters:
- file- location where jmod file will be created.
 
 - 
createClasspathpublic Path createClasspath() Adds an unconfigured<classpath>child element which can specify the files which will comprise the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setClasspath(Path)
 
 - 
getClasspathpublic Path getClasspath() Attribute which specifies the files (usually modular .jar files) which will comprise the created jmod file.- Returns:
- path of constituent files
- See Also:
- setClasspath(Path)
 
 - 
setClasspathpublic void setClasspath(Path path) Sets attribute specifying the files that will comprise the created jmod file. Usually this contains a single modular .jar file.The classpath is required and must not be empty. - Parameters:
- path- path of files that will comprise jmod
- See Also:
- createClasspath()
 
 - 
setClasspathRefpublic void setClasspathRef(Reference ref) Sets classpath attribute from a path reference.- Parameters:
- ref- reference to path which will act as classpath
 
 - 
createModulePathpublic Path createModulePath() Creates a child<modulePath>element which can contain a path of directories containing modules upon which modules in the classpath depend.- Returns:
- new, unconfigured child element
- See Also:
- setModulePath(Path)
 
 - 
getModulePathpublic Path getModulePath() Attribute containing path of directories which contain modules on which the created jmod's constituent modules depend.- Returns:
- path of directories containing modules needed by classpath modules
- See Also:
- setModulePath(Path)
 
 - 
setModulePathpublic void setModulePath(Path path) Sets attribute containing path of directories which contain modules on which the created jmod's constituent modules depend.- Parameters:
- path- path of directories containing modules needed by classpath modules
- See Also:
- createModulePath()
 
 - 
setModulePathRefpublic void setModulePathRef(Reference ref) Sets module path from a path reference.- Parameters:
- ref- reference to path which will act as module path
 
 - 
createCommandPathpublic Path createCommandPath() Creates a child element which can contain a list of directories containing native executable files to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setCommandPath(Path)
 
 - 
getCommandPathpublic Path getCommandPath() Attribute containing path of directories which contain native executable files to include in the created jmod.- Returns:
- list of directories containing native executables
- See Also:
- setCommandPath(Path)
 
 - 
setCommandPathpublic void setCommandPath(Path path) Sets attribute containing path of directories which contain native executable files to include in the created jmod.- Parameters:
- path- list of directories containing native executables
- See Also:
- createCommandPath()
 
 - 
setCommandPathRefpublic void setCommandPathRef(Reference ref) Sets command path from a path reference.- Parameters:
- ref- reference to path which will act as command path
 
 - 
createConfigPathpublic Path createConfigPath() Creates a child element which can contain a list of directories containing user configuration files to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setConfigPath(Path)
 
 - 
getConfigPathpublic Path getConfigPath() Attribute containing list of directories which contain user configuration files.- Returns:
- list of directories containing user configuration files
- See Also:
- setConfigPath(Path)
 
 - 
setConfigPathpublic void setConfigPath(Path path) Sets attribute containing list of directories which contain user configuration files.- Parameters:
- path- list of directories containing user configuration files
- See Also:
- createConfigPath()
 
 - 
setConfigPathRefpublic void setConfigPathRef(Reference ref) Sets configuration file path from a path reference.- Parameters:
- ref- reference to path which will act as configuration file path
 
 - 
createHeaderPathpublic Path createHeaderPath() Creates a child element which can contain a list of directories containing compile-time header files for third party use, to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setHeaderPath(Path)
 
 - 
getHeaderPathpublic Path getHeaderPath() Attribute containing a path of directories which hold compile-time header files for third party use, all of which will be included in the created jmod.- Returns:
- path of directories containing header files
 
 - 
setHeaderPathpublic void setHeaderPath(Path path) Sets attribute containing a path of directories which hold compile-time header files for third party use, all of which will be included in the created jmod.- Parameters:
- path- path of directories containing header files
- See Also:
- createHeaderPath()
 
 - 
setHeaderPathRefpublic void setHeaderPathRef(Reference ref) Sets header path from a path reference.- Parameters:
- ref- reference to path which will act as header path
 
 - 
createLegalPathpublic Path createLegalPath() Creates a child element which can contain a list of directories containing license files to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setLegalPath(Path)
 
 - 
getLegalPathpublic Path getLegalPath() Attribute containing list of directories which hold license files to include in the created jmod.- Returns:
- path containing directories which hold license files
 
 - 
setLegalPathpublic void setLegalPath(Path path) Sets attribute containing list of directories which hold license files to include in the created jmod.- Parameters:
- path- path containing directories which hold license files
- See Also:
- createLegalPath()
 
 - 
setLegalPathRefpublic void setLegalPathRef(Reference ref) Sets legal licenses path from a path reference.- Parameters:
- ref- reference to path which will act as legal path
 
 - 
createNativeLibPathpublic Path createNativeLibPath() Creates a child element which can contain a list of directories containing native libraries to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setNativeLibPath(Path)
 
 - 
getNativeLibPathpublic Path getNativeLibPath() Attribute containing list of directories which hold native libraries to include in the created jmod.- Returns:
- path of directories containing native libraries
 
 - 
setNativeLibPathpublic void setNativeLibPath(Path path) Sets attribute containing list of directories which hold native libraries to include in the created jmod.- Parameters:
- path- path of directories containing native libraries
- See Also:
- createNativeLibPath()
 
 - 
setNativeLibPathRefpublic void setNativeLibPathRef(Reference ref) Sets native library path from a path reference.- Parameters:
- ref- reference to path which will act as native library path
 
 - 
createManPathpublic Path createManPath() Creates a child element which can contain a list of directories containing man pages (program manuals, typically in troff format) to include in the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setManPath(Path)
 
 - 
getManPathpublic Path getManPath() Attribute containing list of directories containing man pages to include in created jmod. Man pages are textual program manuals, typically in troff format.- Returns:
- path containing directories which hold man pages to include in jmod
 
 - 
setManPathpublic void setManPath(Path path) Sets attribute containing list of directories containing man pages to include in created jmod. Man pages are textual program manuals, typically in troff format.- Parameters:
- path- path containing directories which hold man pages to include in jmod
- See Also:
- createManPath()
 
 - 
setManPathRefpublic void setManPathRef(Reference ref) Sets man pages path from a path reference.- Parameters:
- ref- reference to path which will act as module path
 
 - 
createVersionpublic ModuleVersion createVersion() Creates an uninitialized child element representing the version of the module represented by the created jmod.- Returns:
- new, unconfigured child element
- See Also:
- setVersion(String)
 
 - 
getVersionpublic java.lang.String getVersion() Attribute which specifies a module version for created jmod.- Returns:
- module version for created jmod
 
 - 
setVersionpublic void setVersion(java.lang.String version) Sets the module version for the created jmod.- Parameters:
- version- module version of created jmod
- See Also:
- createVersion()
 
 - 
getMainClasspublic java.lang.String getMainClass() Attribute containing the class that acts as the executable entry point of the created jmod.- Returns:
- fully-qualified name of jmod's main class
 
 - 
setMainClasspublic void setMainClass(java.lang.String className) Sets attribute containing the class that acts as the executable entry point of the created jmod.- Parameters:
- className- fully-qualified name of jmod's main class
 
 - 
getPlatformpublic java.lang.String getPlatform() Attribute containing the platform for which the jmod will be built. Platform values are defined in thejava.base.jmodof JDKs, and usually take the form OS-architecture. If unset, current platform is used.- Returns:
- OS and architecture for which jmod will be built, or null
 
 - 
setPlatformpublic void setPlatform(java.lang.String platform) Sets attribute containing the platform for which the jmod will be built. Platform values are defined in thejava.base.jmodof JDKs, and usually take the form OS-architecture. If unset, current platform is used.A JDK's platform can be viewed with a command like: jmod describe $JDK_HOME/jmods/java.base.jmod | grep -i platform. o *- Parameters:
- platform- platform for which jmod will be created, or- null
 
 - 
getHashModulesPatternpublic java.lang.String getHashModulesPattern() Attribute containing a regular expression which specifies which of the modules that depend on the jmod being created should have hashes generated and added to the jmod.- Returns:
- regex specifying which dependent modules should have their generated hashes included
 
 - 
setHashModulesPatternpublic void setHashModulesPattern(java.lang.String pattern) Sets attribute containing a regular expression which specifies which of the modules that depend on the jmod being created should have hashes generated and added to the jmod.- Parameters:
- pattern- regex specifying which dependent modules should have their generated hashes included
 
 - 
getResolveByDefaultpublic boolean getResolveByDefault() Attribute indicating whether the created jmod should be visible in a module path, even when not specified explicitly. True by default.- Returns:
- whether jmod should be visible in module paths
 
 - 
setResolveByDefaultpublic void setResolveByDefault(boolean resolve) Sets attribute indicating whether the created jmod should be visible in a module path, even when not specified explicitly. True by default.- Parameters:
- resolve- whether jmod should be visible in module paths
 
 - 
createModuleWarningpublic Jmod.ResolutionWarningSpec createModuleWarning() Creates a child element which can specify the circumstances under which jmod creation emits warnings.- Returns:
- new, unconfigured child element
- See Also:
- setModuleWarnings(String)
 
 - 
setModuleWarningspublic void setModuleWarnings(java.lang.String warningList) Sets attribute containing a comma-separated list of reasons for jmod creation to emit warnings. Valid values in list are:deprecated,leaving,incubating.- Parameters:
- warningList- list containing one or more of the above values, separated by commas
- See Also:
- createModuleWarning(),- Jmod.ResolutionWarningReason
 
 - 
executepublic void execute() throws BuildExceptionCreates a jmod file according to this task's properties and child elements.- Overrides:
- executein class- Task
- Throws:
- BuildException- if destFile is not set
- BuildException- if classpath is not set or is empty
- BuildException- if any path other than classpath refers to an existing file which is not a directory
- BuildException- if both- versionattribute and- <version>child element are present
- BuildException- if- hashModulesPatternis set, but module path is not defined
 
 
- 
 
-