|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.logging.AbstractLogEnabled
org.codehaus.plexus.archiver.AbstractArchiver
org.codehaus.plexus.archiver.zip.AbstractZipArchiver
org.codehaus.plexus.archiver.zip.ZipArchiver
org.codehaus.plexus.archiver.jar.JarArchiver
public class JarArchiver
Base class for tasks that build archives in JAR file format.
Nested Class Summary | |
---|---|
static class |
JarArchiver.FilesetManifestConfig
|
Field Summary |
---|
Fields inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver |
---|
addedDirs, addingNewFiles, archiveType, doubleFilePass, duplicate, entries, skipWriting |
Fields inherited from interface org.codehaus.plexus.archiver.Archiver |
---|
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS, ROLE |
Constructor Summary | |
---|---|
JarArchiver()
constructor |
Method Summary | |
---|---|
void |
addConfiguredIndexJars(File indexJar)
|
void |
addConfiguredManifest(Manifest newManifest)
Allows the manifest for the archive file to be provided inline in the build file rather than in an external file. |
protected void |
cleanUp()
Make sure we don't think we already have a MANIFEST next time this task gets executed. |
protected boolean |
createEmptyZip(File zipFile)
Create an empty zip file |
protected void |
finalizeZipOutputStream(ZipOutputStream zOut)
|
protected static String |
findJarName(String fileName,
String[] classpath)
try to guess the name of the given file. |
protected static void |
grabFilesAndDirs(String file,
List<String> dirs,
List<String> files)
Grab lists of all root-level files and all directories contained in the given archive. |
protected boolean |
hasVirtualFiles()
|
protected void |
initZipOutputStream(ZipOutputStream zOut)
method for subclasses to override |
void |
reset()
reset to default values. |
void |
setFilesetmanifest(JarArchiver.FilesetManifestConfig config)
Behavior when a Manifest is found in a zipfileset or zipgroupfileset file. |
void |
setIndex(boolean flag)
Set whether or not to create an index list for classes. |
void |
setManifest(File manifestFile)
The manifest file to use. |
void |
setManifestEncoding(String manifestEncoding)
Set whether or not to create an index list for classes. |
protected void |
writeIndexLikeList(List<String> dirs,
List<String> files,
PrintWriter writer)
Writes the directory entries from the first and the filenames from the second list to the given writer, one entry per line. |
protected void |
zipFile(InputStream is,
ZipOutputStream zOut,
String vPath,
long lastModified,
File fromArchive,
int mode)
Overridden from Zip class to deal with manifests and index lists. |
Methods inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver |
---|
addParentDirs, addResources, close, execute, getArchiveType, getComment, getEncoding, getZipEntryNames, isCompress, isFileAdded, isFilesonly, isFileUpdated, isInUpdateMode, isRoundUp, isSupportingForced, revert, setComment, setCompress, setEncoding, setFilesonly, setRoundUp, setUpdateMode, zipDir, zipFile |
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled |
---|
enableLogging, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JarArchiver()
Method Detail |
---|
public void setIndex(boolean flag)
flag
- true to create an indexpublic void setManifestEncoding(String manifestEncoding)
public void addConfiguredManifest(Manifest newManifest) throws ManifestException
newManifest
- The new manifest
ManifestException
- .public void setManifest(File manifestFile) throws ArchiverException
manifestFile
- the manifest file to use.
ArchiverException
- .public void setFilesetmanifest(JarArchiver.FilesetManifestConfig config)
config
- setting for found manifest behavior.public void addConfiguredIndexJars(File indexJar)
indexJar
- The indexjarprotected void initZipOutputStream(ZipOutputStream zOut) throws IOException, ArchiverException
AbstractZipArchiver
initZipOutputStream
in class AbstractZipArchiver
IOException
ArchiverException
protected boolean hasVirtualFiles()
hasVirtualFiles
in class AbstractArchiver
protected void finalizeZipOutputStream(ZipOutputStream zOut) throws IOException, ArchiverException
finalizeZipOutputStream
in class AbstractZipArchiver
IOException
ArchiverException
protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode) throws IOException, ArchiverException
zipFile
in class AbstractZipArchiver
is
- the stream to read data for the entry from.zOut
- the stream to write to.vPath
- the name this entry shall have in the archive.lastModified
- last modification time for the entry.fromArchive
- the original archive we are copying this
entry from, will be null if we are not copying from an archive.mode
- the Unix permissions to set.
IOException
ArchiverException
protected boolean createEmptyZip(File zipFile) throws ArchiverException
AbstractZipArchiver
createEmptyZip
in class AbstractZipArchiver
zipFile
- The file
ArchiverException
protected void cleanUp()
cleanUp
in class AbstractZipArchiver
AbstractZipArchiver.cleanUp()
public void reset()
reset
in class AbstractZipArchiver
AbstractZipArchiver.reset()
protected final void writeIndexLikeList(List<String> dirs, List<String> files, PrintWriter writer)
dirs
- The directoriesfiles
- The fileswriter
- The printwriter ;)protected static String findJarName(String fileName, String[] classpath)
If this jar has a classpath attribute in its manifest, we can assume that it will only require an index of jars listed there. try to find which classpath entry is most likely the one the given file name points to.
In the absence of a classpath attribute, assume the other files will be placed inside the same directory as this jar and use their basename.
if there is a classpath and the given file doesn't match any of its entries, return null.
fileName
- .classpath
- .
protected static void grabFilesAndDirs(String file, List<String> dirs, List<String> files) throws IOException
file
- .files
- .dirs
- .
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |