public class Jmod extends Task
Supported attributes:
destFile
classpath
classpathref
modulepath
modulepathref
commandpath
commandpathref
headerpath
headerpathref
configpath
configpathref
legalpath
legalpathref
nativelibpath
nativelibpathref
manpath
manpathref
version
mainclass
platform
jmod describe $JDK_HOME/jmods/java.base.jmod | grep -i platform
.
hashModulesPattern
resolveByDefault
moduleWarnings
deprecated
leaving
incubating
Supported nested elements:
<classpath>
<modulepath>
<commandpath>
<headerpath>
<configpath>
<legalpath>
<nativelibpath>
<manpath>
<version>
number
attribute. May also have optional
preRelease
and build
attributes.
<moduleWarning>
reason
. See moduleWarnings
attribute above. This element may be specified multiple times.
destFile and classpath are required data.
Modifier and Type | Class and Description |
---|---|
static class |
Jmod.ResolutionWarningReason
Permissible reasons for jmod creation to emit warnings.
|
class |
Jmod.ResolutionWarningSpec
Child element which enables jmod tool warnings.
|
description, location, project
Constructor and Description |
---|
Jmod() |
Modifier and Type | Method and Description |
---|---|
Path |
createClasspath()
Adds an unconfigured
<classpath> child element which can
specify the files which will comprise the created jmod. |
Path |
createCommandPath()
Creates a child element which can contain a list of directories
containing native executable files to include in the created jmod.
|
Path |
createConfigPath()
Creates a child element which can contain a list of directories
containing user configuration files to include in the created jmod.
|
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.
|
Path |
createLegalPath()
Creates a child element which can contain a list of directories
containing license files to include in the created jmod.
|
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.
|
Path |
createModulePath()
Creates a child
<modulePath> element which can contain a
path of directories containing modules upon which modules in the
classpath depend. |
Jmod.ResolutionWarningSpec |
createModuleWarning()
Creates a child element which can specify the circumstances
under which jmod creation emits warnings.
|
Path |
createNativeLibPath()
Creates a child element which can contain a list of directories
containing native libraries to include in the created jmod.
|
ModuleVersion |
createVersion()
Creates an uninitialized child element representing the version of
the module represented by the created jmod.
|
void |
execute()
Creates a jmod file according to this task's properties
and child elements.
|
Path |
getClasspath()
Attribute which specifies the files (usually modular .jar files)
which will comprise the created jmod file.
|
Path |
getCommandPath()
Attribute containing path of directories which contain native
executable files to include in the created jmod.
|
Path |
getConfigPath()
Attribute containing list of directories which contain
user configuration files.
|
java.io.File |
getDestFile()
Attribute containing the location of the jmod file to create.
|
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.
|
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.
|
Path |
getLegalPath()
Attribute containing list of directories which hold license files
to include in the created jmod.
|
java.lang.String |
getMainClass()
Attribute containing the class that acts as the executable entry point
of the created jmod.
|
Path |
getManPath()
Attribute containing list of directories containing man pages
to include in created jmod.
|
Path |
getModulePath()
Attribute containing path of directories which contain modules on which
the created jmod's constituent modules
depend.
|
Path |
getNativeLibPath()
Attribute containing list of directories which hold native libraries
to include in the created jmod.
|
java.lang.String |
getPlatform()
Attribute containing the platform for which the jmod
will be built.
|
boolean |
getResolveByDefault()
Attribute indicating whether the created jmod should be visible
in a module path, even when not specified explicitly.
|
java.lang.String |
getVersion()
Attribute which specifies
a module version
for created jmod.
|
void |
setClasspath(Path path)
Sets attribute specifying the files that will comprise the created jmod
file.
|
void |
setClasspathRef(Reference ref)
Sets classpath attribute from a
path reference.
|
void |
setCommandPath(Path path)
Sets attribute containing path of directories which contain native
executable files to include in the created jmod.
|
void |
setCommandPathRef(Reference ref)
Sets command path
from a path reference.
|
void |
setConfigPath(Path path)
Sets attribute containing list of directories which contain
user configuration files.
|
void |
setConfigPathRef(Reference ref)
Sets configuration file path
from a path reference.
|
void |
setDestFile(java.io.File file)
Sets attribute containing the location of the jmod file to create.
|
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.
|
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.
|
void |
setHeaderPathRef(Reference ref)
Sets header path
from a path reference.
|
void |
setLegalPath(Path path)
Sets attribute containing list of directories which hold license files
to include in the created jmod.
|
void |
setLegalPathRef(Reference ref)
Sets legal licenses path
from a path reference.
|
void |
setMainClass(java.lang.String className)
Sets attribute containing the class that acts as the
executable entry point of the created jmod.
|
void |
setManPath(Path path)
Sets attribute containing list of directories containing man pages
to include in created jmod.
|
void |
setManPathRef(Reference ref)
Sets man pages path
from a path reference.
|
void |
setModulePath(Path path)
Sets attribute containing path of directories which contain modules
on which the created jmod's
constituent modules depend.
|
void |
setModulePathRef(Reference ref)
Sets module path
from a path reference.
|
void |
setModuleWarnings(java.lang.String warningList)
Sets attribute containing a comma-separated list of reasons for
jmod creation to emit warnings.
|
void |
setNativeLibPath(Path path)
Sets attribute containing list of directories which hold native libraries
to include in the created jmod.
|
void |
setNativeLibPathRef(Reference ref)
Sets native library path
from a path reference.
|
void |
setPlatform(java.lang.String platform)
Sets attribute containing the platform for which the jmod
will be built.
|
void |
setResolveByDefault(boolean resolve)
Sets attribute indicating whether the created jmod should be visible
in a module path, even when not specified explicitly.
|
void |
setVersion(java.lang.String version)
Sets the module version
for the created jmod.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public java.io.File getDestFile()
setDestFile(File)
public void setDestFile(java.io.File file)
file
- location where jmod file will be created.public Path createClasspath()
<classpath>
child element which can
specify the files which will comprise the created jmod.setClasspath(Path)
public Path getClasspath()
setClasspath(Path)
public void setClasspath(Path path)
The classpath is required and must not be empty.
path
- path of files that will comprise jmodcreateClasspath()
public void setClasspathRef(Reference ref)
ref
- reference to path which will act as classpathpublic Path createModulePath()
<modulePath>
element which can contain a
path of directories containing modules upon which modules in the
classpath depend.setModulePath(Path)
public Path getModulePath()
setModulePath(Path)
public void setModulePath(Path path)
path
- path of directories containing modules needed by
classpath modulescreateModulePath()
public void setModulePathRef(Reference ref)
ref
- reference to path which will act as module pathpublic Path createCommandPath()
setCommandPath(Path)
public Path getCommandPath()
setCommandPath(Path)
public void setCommandPath(Path path)
path
- list of directories containing native executablescreateCommandPath()
public void setCommandPathRef(Reference ref)
ref
- reference to path which will act as command pathpublic Path createConfigPath()
setConfigPath(Path)
public Path getConfigPath()
setConfigPath(Path)
public void setConfigPath(Path path)
path
- list of directories containing user configuration filescreateConfigPath()
public void setConfigPathRef(Reference ref)
ref
- reference to path which will act as configuration file pathpublic Path createHeaderPath()
setHeaderPath(Path)
public Path getHeaderPath()
public void setHeaderPath(Path path)
path
- path of directories containing header filescreateHeaderPath()
public void setHeaderPathRef(Reference ref)
ref
- reference to path which will act as header pathpublic Path createLegalPath()
setLegalPath(Path)
public Path getLegalPath()
public void setLegalPath(Path path)
path
- path containing directories which hold license filescreateLegalPath()
public void setLegalPathRef(Reference ref)
ref
- reference to path which will act as legal pathpublic Path createNativeLibPath()
setNativeLibPath(Path)
public Path getNativeLibPath()
public void setNativeLibPath(Path path)
path
- path of directories containing native librariescreateNativeLibPath()
public void setNativeLibPathRef(Reference ref)
ref
- reference to path which will act as native library pathpublic Path createManPath()
setManPath(Path)
public Path getManPath()
public void setManPath(Path path)
path
- path containing directories which hold man pages to include
in jmodcreateManPath()
public void setManPathRef(Reference ref)
ref
- reference to path which will act as module pathpublic ModuleVersion createVersion()
setVersion(String)
public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version
- module version of created jmodcreateVersion()
public java.lang.String getMainClass()
public void setMainClass(java.lang.String className)
className
- fully-qualified name of jmod's main classpublic java.lang.String getPlatform()
java.base.jmod
of JDKs, and usually take the form
OS-
architecture. If unset,
current platform is used.null
public void setPlatform(java.lang.String platform)
java.base.jmod
of 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 *
platform
- platform for which jmod will be created, or null
public java.lang.String getHashModulesPattern()
public void setHashModulesPattern(java.lang.String pattern)
pattern
- regex specifying which dependent modules should have
their generated hashes includedpublic boolean getResolveByDefault()
public void setResolveByDefault(boolean resolve)
resolve
- whether jmod should be visible in module pathspublic Jmod.ResolutionWarningSpec createModuleWarning()
setModuleWarnings(String)
public void setModuleWarnings(java.lang.String warningList)
deprecated
, leaving
, incubating
.warningList
- list containing one or more of the above values,
separated by commascreateModuleWarning()
,
Jmod.ResolutionWarningReason
public void execute() throws BuildException
execute
in class Task
BuildException
- if destFile is not setBuildException
- if classpath is not set or is emptyBuildException
- if any path other than classpath refers to an
existing file which is not a directoryBuildException
- if both version
attribute and
<version>
child element are presentBuildException
- if hashModulesPattern
is set, but
module path is not defined