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
public abstract class ModularJarArchiver extends JarArchiver
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 tonull
, then theMain-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
Constructors Constructor Description ModularJarArchiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Manifest
createManifest()
Creates the manifest to be added to the JAR archive.protected String
getManifestMainClass()
Returns the "Main-Class" attribute of the manifest added to the archive.String
getModuleMainClass()
String
getModuleVersion()
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, isForced, isIgnorePermissions, isUptodate, isUseJvmChmod, postCreateArchive, runArchiveFinalizers, setArchiveFinalizers, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setDirectoryMode, setDotFileDirectory, setDuplicateBehavior, setFileMode, setFilenameComparator, setForced, setIgnorePermissions, setIncludeEmptyDirs, setLastModifiedDate, setLastModifiedTime, setOverrideGid, setOverrideGroupName, setOverrideUid, setOverrideUserName, setUseJvmChmod, validate
-
-
-
-
Method Detail
-
getModuleMainClass
public String getModuleMainClass()
-
setModuleMainClass
public void setModuleMainClass(String moduleMainClass)
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
public String getModuleVersion()
-
setModuleVersion
public void setModuleVersion(String moduleVersion)
Sets the module version. Ignored if the JAR file does not contain module descriptor.- Parameters:
moduleVersion
- the module version.
-
getManifestMainClass
protected String 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
protected 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:
AbstractZipArchiver.reset()
-
-