Class ModularJarArchiver
java.lang.Object
org.codehaus.plexus.archiver.AbstractArchiver
org.codehaus.plexus.archiver.zip.AbstractZipArchiver
org.codehaus.plexus.archiver.zip.ZipArchiver
org.codehaus.plexus.archiver.jar.JarArchiver
org.codehaus.plexus.archiver.jar.ModularJarArchiver
- All Implemented Interfaces:
Archiver, FinalizerEnabled
- Direct Known Subclasses:
JarToolModularJarArchiver
Base class for creating modular JAR archives.
Subclasses are required to be able to handle both
JAR archives with module descriptor (modular JAR)
and without ("regular" JAR).
That would allow clients of this class to use
it without prior knowledge if the classes
they are going to add are part of module
(contain module descriptor class) or not.
The class allows you to set the
module main class (setModuleMainClass(String)),
but if it is not set or it is set to null,
then the Main-Class attribute of the
JAR manifest is used (if present) to set
the module main class.
- Since:
- 3.6
-
Nested Class Summary
Nested classes/interfaces inherited from class JarArchiver
JarArchiver.FilesetManifestConfig -
Field Summary
Fields inherited from class AbstractZipArchiver
addedDirs, addingNewFiles, archiveType, doubleFilePass, duplicate, entries, skipWriting, zipArchiveOutputStreamFields inherited from interface Archiver
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DEFAULT_SYMLILNK_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ManifestCreates the manifest to be added to the JAR archive.protected StringReturns the "Main-Class" attribute of the manifest added to the archive.voidreset()reset to default values.voidsetModuleMainClass(String moduleMainClass) Sets the module main class.voidsetModuleVersion(String moduleVersion) Sets the module version.Methods inherited from class JarArchiver
addConfiguredIndexJars, addConfiguredManifest, cleanUp, createEmptyZip, finalizeZipOutputStream, findJarName, hasVirtualFiles, initZipOutputStream, setFilesetmanifest, setIndex, setManifest, setManifestEncoding, setMinimalDefaultManifest, setZipEntryTime, writeIndexLikeList, zipFileMethods inherited from class AbstractZipArchiver
addResources, close, execute, getArchiveType, getComment, getEncoding, getFiles, isCompress, isFilesonly, isInUpdateMode, isRecompressAddedZips, isSupportingForced, normalizeLastModifiedTime, revert, setComment, setCompress, setEncoding, setFilesonly, setRecompressAddedZips, setUpdateMode, zipDir, zipFileMethods inherited from class AbstractArchiver
addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchiveFinalizer, addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, addFileSet, addResource, addResources, addSymlink, addSymlink, asArchiveEntry, asResourceCollection, checkForced, configureReproducible, configureReproducibleBuild, createArchive, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirectoryMode, getDuplicateBehavior, getFileMode, getFilenameComparator, getIncludeEmptyDirs, getLastModifiedDate, getLastModifiedTime, getLogger, getOverrideDirectoryMode, getOverrideFileMode, getOverrideGid, getOverrideGroupName, getOverrideUid, getOverrideUserName, getRawDefaultFileMode, getResources, getUmask, isForced, isIgnorePermissions, isUptodate, isUseJvmChmod, postCreateArchive, runArchiveFinalizers, setArchiveFinalizers, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setDirectoryMode, setDotFileDirectory, setDuplicateBehavior, setFileMode, setFilenameComparator, setForced, setIgnorePermissions, setIncludeEmptyDirs, setLastModifiedDate, setLastModifiedTime, setOverrideGid, setOverrideGroupName, setOverrideUid, setOverrideUserName, setUmask, setUseJvmChmod, validate
-
Constructor Details
-
ModularJarArchiver
public ModularJarArchiver()
-
-
Method Details
-
getModuleMainClass
-
setModuleMainClass
Sets the module main class. Ignored if the JAR file does not contain module descriptor.Note that implementations may choose to replace the value set in the manifest as well.
- Parameters:
moduleMainClass- the module main class.
-
getModuleVersion
-
setModuleVersion
Sets the module version. Ignored if the JAR file does not contain module descriptor.- Parameters:
moduleVersion- the module version.
-
getManifestMainClass
Returns the "Main-Class" attribute of the manifest added to the archive.nullif there is no manifest or the attribute is not set.- Returns:
- the "Main-Class" attribute of the manifest
-
createManifest
Description copied from class:JarArchiverCreates the manifest to be added to the JAR archive. Sub-classes may choose to override this method in order to inspect or modify the JAR manifest file.- Overrides:
createManifestin classJarArchiver- Returns:
- the manifest for the JAR archive.
-
reset
public void reset()Description copied from class:JarArchiverreset to default values.- Overrides:
resetin classJarArchiver- See Also:
-