Package org.codehaus.plexus.archiver.jar
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 org.codehaus.plexus.archiver.jar.JarArchiver
JarArchiver.FilesetManifestConfig
-
Field Summary
Fields inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver
addedDirs, addingNewFiles, archiveType, doubleFilePass, duplicate, entries, skipWriting, zipArchiveOutputStream
Fields inherited from interface org.codehaus.plexus.archiver.Archiver
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DEFAULT_SYMLILNK_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Manifest
Creates the manifest to be added to the JAR archive.protected String
Returns the "Main-Class" attribute of the manifest added to the archive.void
reset()
reset to default values.void
setModuleMainClass
(String moduleMainClass) Sets the module main class.void
setModuleVersion
(String moduleVersion) Sets the module version.Methods inherited from class org.codehaus.plexus.archiver.jar.JarArchiver
addConfiguredIndexJars, addConfiguredManifest, cleanUp, createEmptyZip, finalizeZipOutputStream, findJarName, hasVirtualFiles, initZipOutputStream, setFilesetmanifest, setIndex, setManifest, setManifestEncoding, setMinimalDefaultManifest, setZipEntryTime, writeIndexLikeList, zipFile
Methods inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver
addResources, close, execute, getArchiveType, getComment, getEncoding, isCompress, isFilesonly, isInUpdateMode, isRecompressAddedZips, isSupportingForced, normalizeLastModifiedTime, revert, setComment, setCompress, setEncoding, setFilesonly, setRecompressAddedZips, setUpdateMode, zipDir, zipFile
Methods inherited from class org.codehaus.plexus.archiver.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, getFiles, 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.null
if there is no manifest or the attribute is not set.- Returns:
- the "Main-Class" attribute of the manifest
-
createManifest
Description copied from class:JarArchiver
Creates 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:
createManifest
in classJarArchiver
- Returns:
- the manifest for the JAR archive.
-
reset
public void reset()Description copied from class:JarArchiver
reset to default values.- Overrides:
reset
in classJarArchiver
- See Also:
-