org.codehaus.plexus.archiver.Archiver Java Examples

The following examples show how to use org.codehaus.plexus.archiver.Archiver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 5 votes vote down vote up
/**
 * put all dependencies together into archive
 *
 * @param archiver ark plugin archiver
 * @param dependencies all dependencies of ark plugin
 * @param conflicts dependencies whose jar name (artifact id) is conflict
 */
protected void addArkPluginArtifact(Archiver archiver, Set<Artifact> dependencies,
                                    Set<Artifact> conflicts) {
    addArtifact(archiver, project.getArtifact(), conflicts.contains(project.getArtifact()));
    for (Artifact artifact : dependencies) {
        if (Repackager.isZip(artifact.getFile())) {
            addArtifact(archiver, artifact, conflicts.contains(artifact));
        }
    }
}
 
Example #2
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 5 votes vote down vote up
/**
 * add a artifact into archiver
 *
 * @param archiver archiver which represents a ark plugin
 * @param artifact artifact which will be put into archiver
 * @param artifactIdConflict whether artifact is conflicted, it will determine the final jar name.
 */
protected void addArtifact(Archiver archiver, Artifact artifact, boolean artifactIdConflict) {
    if (isShadeJar(artifact)) {
        return;
    }
    String destination = artifact.getFile().getName();
    if (artifactIdConflict) {
        destination = artifact.getGroupId() + "-" + destination;
    }
    destination = "lib/" + destination;
    getLog().debug("  " + artifact + " => " + destination);
    archiver.addFile(artifact.getFile(), destination);
}
 
Example #3
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 5 votes vote down vote up
private void addManifest(Archiver archiver) throws MojoExecutionException {
    LinkedProperties properties = new LinkedProperties();

    properties.setProperty("groupId", groupId);
    properties.setProperty("artifactId", artifactId);
    properties.setProperty("version", version);
    properties.setProperty("priority", String.valueOf(priority));
    properties.setProperty("pluginName", pluginName);
    properties.setProperty("description", description);
    properties.setProperty("activator", activator == null ? "" : activator);
    properties.putAll(collectArkPluginImport());
    properties.putAll(collectArkPluginExport());

    addArkPluginConfig(archiver, "META-INF/MANIFEST.MF", properties);
}
 
Example #4
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 4 votes vote down vote up
private void addArkPluginMark(Archiver archiver) throws MojoExecutionException {
    addArkPluginConfig(archiver, Constants.ARK_PLUGIN_MARK_ENTRY, new LinkedProperties());
}
 
Example #5
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 2 votes vote down vote up
/**
 * create a zip archiver
 *
 * @return a un-compress zip archiver
 * @throws NoSuchArchiverException
 */
protected Archiver getArchiver() throws NoSuchArchiverException {
    Archiver archiver = archiverManager.getArchiver(ARCHIVE_MODE);
    ((AbstractZipArchiver) archiver).setCompress(false);
    return archiver;
}
 
Example #6
Source File: ArkPluginMojo.java    From sofa-ark with Apache License 2.0 2 votes vote down vote up
/**
 * generate ark.plugin configuration file
 * archive
 * @param archiver
 * @throws MojoExecutionException
 */
protected void addArkPluginConfig(Archiver archiver) throws MojoExecutionException {
    addManifest(archiver);
    addArkPluginMark(archiver);
}