• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Manifest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.codehaus.plexus.archiver.jar.Manifest的典型用法代码示例。如果您正苦于以下问题:Java Manifest类的具体用法?Java Manifest怎么用?Java Manifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Manifest类属于org.codehaus.plexus.archiver.jar包,在下文中一共展示了Manifest类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addCustomManifestSections

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private static void addCustomManifestSections(@NotNull Manifest manifest, @NotNull Element mavenArchiveConfiguration)
  throws ManifestException {

  for (Element section : MavenJDOMUtil.findChildrenByPath(mavenArchiveConfiguration, "manifestSections", "manifestSection")) {
    Manifest.Section theSection = new Manifest.Section();

    final String sectionName = MavenJDOMUtil.findChildValueByPath(section, "name");
    theSection.setName(sectionName);

    final Element manifestEntries = section.getChild("manifestEntries");
    Map<String, String> entries = getManifestEntries(manifestEntries);

    if (!entries.isEmpty()) {
      for (Map.Entry<String, String> entry : entries.entrySet()) {
        Attribute attr = new Attribute(entry.getKey(), entry.getValue());
        theSection.addConfiguredAttribute(attr);
      }
    }
    manifest.addConfiguredSection(theSection);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ManifestBuilder.java


示例2: addManifestEntries

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private static void addManifestEntries(@NotNull Manifest manifest, @NotNull Map<String, String> entries)
  throws ManifestException {
  if (!entries.isEmpty()) {
    for (Map.Entry<String, String> entry : entries.entrySet()) {
      Attribute attr = manifest.getMainSection().getAttribute(entry.getKey());
      if ("Class-Path".equals(entry.getKey()) && attr != null) {
        // Merge the user-supplied Class-Path value with the programmatically
        // generated Class-Path.  Note that the user-supplied value goes first
        // so that resources there will override any in the standard Class-Path.
        attr.setValue(entry.getValue() + " " + attr.getValue());
      }
      else {
        addManifestAttribute(manifest, entry.getKey(), entry.getValue());
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ManifestBuilder.java


示例3: merge

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private static void merge(@NotNull java.util.jar.Manifest target, @Nullable java.util.jar.Manifest other) {
  if (other != null) {
    mergeAttributes(target.getMainAttributes(), other.getMainAttributes());

    for (Map.Entry<String, Attributes> o : other.getEntries().entrySet()) {
      Attributes ourSection = target.getAttributes(o.getKey());
      Attributes otherSection = o.getValue();
      if (ourSection == null) {
        if (otherSection != null) {
          target.getEntries().put(o.getKey(), (Attributes)otherSection.clone());
        }
      }
      else {
        mergeAttributes(ourSection, otherSection);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ManifestBuilder.java


示例4: getPluginManifest

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private Manifest getPluginManifest() throws ManifestException {
    getLog().debug("Generating plugin manifest");
    Manifest manifest = new Manifest();
    addAttribute(manifest, ManifestField.NAME.getFieldName(), pluginName);
    addAttribute(manifest, ManifestField.VERSION.getFieldName(), pluginVersion);
    addAttribute(manifest, ManifestField.DATE.getFieldName(), ZonedDateTime.now().format(DefaultManifestReader.DATE_FORMATTER));
    if (description != null) {
        addAttribute(manifest, ManifestField.DESCRIPTION.getFieldName(), description);
    }
    if (maintainer != null) {
        addAttribute(manifest, ManifestField.MAINTAINER.getFieldName(), maintainer);
    }
    if (depends != null) {
        addAttribute(manifest, ManifestField.DEPENDS.getFieldName(), joinDependencies(depends));
    }
    if (conflicts != null) {
        addAttribute(manifest, ManifestField.CONFLICTS.getFieldName(), joinDependencies(conflicts));
    }
    if (provides != null) {
        addAttribute(manifest, ManifestField.PROVIDES.getFieldName(), provides);
    }
    return manifest;
}
 
开发者ID:meridor,项目名称:stecker,代码行数:24,代码来源:CreateMojo.java


示例5: createArchive

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private void createArchive(File installerFile) throws JbiPluginException {
    try {
        getLog().info("Generating service assembly " + installerFile.getAbsolutePath());
        MavenArchiver archiver = new MavenArchiver();
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(installerFile);
        Manifest m = createManifest();
        String version = getProject().getArtifact().getVersion();
        // add Implementation-Version attribute in the MANIFEST
        m.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Implementation-Version", version));

        getLog().info("Add Implementation-Version: " + version);

        jarArchiver.addConfiguredManifest(m);

        File classesDir = new File(getProject().getBuild().getOutputDirectory());
        if ( classesDir.exists() )
            jarArchiver.addDirectory(classesDir, null, DirectoryScanner.DEFAULTEXCLUDES);

        jarArchiver.addDirectory(workDirectory, null, DirectoryScanner.DEFAULTEXCLUDES);
        archiver.createArchive(getProject(), archive);
    } catch (Exception e) {
        throw new JbiPluginException("Error creating shared library: "
                + e.getMessage(), e);
    }
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:27,代码来源:GenerateServiceAssemblyMojo.java


示例6: build

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
@NotNull
public java.util.jar.Manifest build() throws ManifestBuilderException {
  try {
    Element mavenPackagingPluginConfiguration = getMavenPackagingPluginConfiguration(myMavenProject);
    final Element mavenArchiveConfiguration =
      mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null;

    if (mavenArchiveConfiguration == null) return getDefaultManifest(Collections.<String, String>emptyMap());

    final Element manifestEntries = mavenArchiveConfiguration.getChild("manifestEntries");
    Map<String, String> entries = getManifestEntries(manifestEntries);

    final Element manifestConfiguration = mavenArchiveConfiguration.getChild("manifest");
    final Manifest configuredManifest = getConfiguredManifest(myMavenProject, manifestConfiguration, entries);

    if (!entries.isEmpty()) {
      addManifestEntries(configuredManifest, entries);
    }

    addCustomManifestSections(configuredManifest, mavenArchiveConfiguration);

    Manifest finalManifest = getDefaultManifest(entries);
    // merge configured manifest
    merge(finalManifest, configuredManifest);

    // merge user supplied manifest
    final Manifest userSuppliedManifest = getUserSuppliedManifest(mavenArchiveConfiguration);
    merge(finalManifest, userSuppliedManifest);
    return finalManifest;
  }
  catch (ManifestException e) {
    throw new ManifestBuilderException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ManifestBuilder.java


示例7: getDefaultManifest

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
@NotNull
private Manifest getDefaultManifest(@NotNull Map<String, String> entries) throws ManifestException {
  Manifest finalManifest = new Manifest();
  addManifestAttribute(finalManifest, entries, "Created-By", ApplicationNamesInfo.getInstance().getFullProductName());
  addManifestAttribute(finalManifest, entries, "Built-By", System.getProperty("user.name"));
  if (!StringUtil.isEmpty(myJdkVersion)) {
    addManifestAttribute(finalManifest, entries, "Build-Jdk", myJdkVersion);
  }
  return finalManifest;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ManifestBuilder.java


示例8: createManifest

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
protected Manifest createManifest() throws ManifestException {
    Manifest manifest = new Manifest();
    //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Bundle-Name", project.getName()));
    //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Bundle-SymbolicName", project.getArtifactId()));
    //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute(
        //"Bundle-Version", fixBundleVersion(project.getVersion())));
    return manifest;
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:9,代码来源:AbstractJbiMojo.java


示例9: process

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private File process() throws IOException, ManifestException {
    getLog().info("Building webjar for " + project.getArtifactId());
    File output = new File(buildDirectory, webjar.getOutputFileName());
    FileUtils.deleteQuietly(output);

    // Compute the set of selected files:
    Collection<File> selected = webjar.getSelectedFiles();
    if (selected.isEmpty()) {
        getLog().warn("No file selected in the webjar - skipping creation");
        return null;
    }
    String root = computeRoot();

    FileUtils.deleteQuietly(output);

    // Web jar are jar file, so use the Plexus Archiver.
    JarArchiver archiver = new JarArchiver();
    archiver.enableLogging(new PlexusLoggerWrapper(getLog()));
    String base = webjar.getFileset().getDirectory();
    for (File file : selected) {
        final String destFileName = root + "/" + file.getAbsolutePath().substring(base.length() + 1);
        getLog().debug(file.getName() + " => " + destFileName);
        archiver.addFile(file, destFileName);
    }

    // Extend the manifest with webjar data - this is not required by the webjar specification
    Manifest manifest = Manifest.getDefaultManifest();
    manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Webjar-Name", webjar.getName()));
    manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Webjar-Version", webjar.getVersion()));
    manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Created-By", "Wisdom Framework " +
            BuildConstants.get("WISDOM_PLUGIN_VERSION")));
    archiver.addConfiguredManifest(manifest);
    archiver.setDestFile(output);
    archiver.createArchive();
    return output;
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:37,代码来源:WebJarPackager.java


示例10: getConfiguredManifest

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
@NotNull
private static Manifest getConfiguredManifest(@NotNull MavenProject mavenProject,
                                              @Nullable Element manifestConfiguration,
                                              @NotNull Map<String, String> entries) throws ManifestException {
  final Manifest manifest = new Manifest();

  boolean isAddDefaultSpecificationEntries =
    Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultSpecificationEntries", "false"));
  if (isAddDefaultSpecificationEntries) {
    addManifestAttribute(manifest, entries, "Specification-Title", mavenProject.getName());
    addManifestAttribute(manifest, entries, "Specification-Version", mavenProject.getMavenId().getVersion());
  }

  boolean isAddDefaultImplementationEntries =
    Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultImplementationEntries", "false"));
  if (isAddDefaultImplementationEntries) {
    addManifestAttribute(manifest, entries, "Implementation-Title", mavenProject.getName());
    addManifestAttribute(manifest, entries, "Implementation-Version", mavenProject.getMavenId().getVersion());
    addManifestAttribute(manifest, entries, "Implementation-Vendor-Id", mavenProject.getMavenId().getGroupId());
  }

  String packageName = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "packageName");
  if (packageName != null) {
    addManifestAttribute(manifest, entries, "Package", packageName);
  }

  String mainClass = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "mainClass");
  if (!StringUtil.isEmpty(mainClass)) {
    addManifestAttribute(manifest, entries, "Main-Class", mainClass);
  }

  boolean isAddClasspath = Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addClasspath", "false"));
  if (isAddClasspath) {
    final ManifestImporter manifestImporter = ManifestImporter.getManifestImporter(mavenProject.getPackaging());
    String classpath = manifestImporter.getClasspath(mavenProject, manifestConfiguration);
    if (!classpath.isEmpty()) {
      addManifestAttribute(manifest, "Class-Path", classpath);
    }
  }
  return manifest;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:ManifestBuilder.java


示例11: addManifestAttribute

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private static void addManifestAttribute(@NotNull Manifest manifest, @NotNull Map<String, String> map, String key, String value)
  throws ManifestException {
  if (map.containsKey(key)) return;
  addManifestAttribute(manifest, key, value);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ManifestBuilder.java


示例12: addAttribute

import org.codehaus.plexus.archiver.jar.Manifest; //导入依赖的package包/类
private void addAttribute(Manifest manifest, String name, String value) throws ManifestException {
    getLog().debug(String.format("Setting manifest field %s to %s", name, value));
    manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute(name, value));
}
 
开发者ID:meridor,项目名称:stecker,代码行数:5,代码来源:CreateMojo.java



注:本文中的org.codehaus.plexus.archiver.jar.Manifest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MUCInitialPresence类代码示例发布时间:2022-05-22
下一篇:
Java CredentialRequestResult类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap