Package com.subhajit.build

Examples of com.subhajit.build.Manifest


        // Create the project jar file.
        File projectJarFile = new File(zipDir, eclipseProject.getName()
            + ".jar");
        // Update the manifest.
        // If there is already a manifest file, load it.
        Manifest manifest = null;
        File manifestFile = new File(projectJarDir,
            "META-INF/MANIFEST.MF");
        if (manifestFile.exists()) {
          manifest = loadManifest(manifestFile);
        } else {
          manifest = CreateJarUtils.createDefaultManifest();
        }
        progress.increment(1, "Creating manifest files");
        if (manifest.getMainSection().getAttribute("Main-Class") != null) {
          manifest.getMainSection().removeAttribute("Main-Class");
        }
        manifest.getMainSection().addConfiguredAttribute(
            new Manifest.Attribute("Main-Class", mainClass));
        FileUtils.mkdirs(manifestFile.getParentFile());
        saveManifest(manifestFile, manifest);

        // Create the jar.
View Full Code Here


  private static Manifest loadManifest(File manifestFile) throws IOException,
      ManifestException {
    StringReader reader = null;
    try {
      reader = new StringReader(FileUtils.loadTextFile(manifestFile));
      return new Manifest(reader);
    } finally {
      if (reader != null) {
        reader.close();
      }
    }
View Full Code Here

  static final URL[] ZERO_LENGTH_URL_ARRAY = new URL[0];

  protected static Manifest createManifest(EclipseProject project,
      String mainClass) throws ManifestException, IOException,
      JDOMException, InterruptedException {
    Manifest ret = createDefaultManifest();

    if (mainClass != null) {
      ret.addConfiguredAttribute(new Manifest.Attribute("Main-Class",
          mainClass));
    }

    // Get all classpath elements.
    StringBuilder str = new StringBuilder();
    for (EclipseMetafile metafile : project.getAllDependants()) {
      if (metafile instanceof CompiledJar) {
        if (str.length() != 0) {
          str.append(" ");
        }
        str.append(((CompiledJar) metafile).getFile().getName());
      }
    }
    ret.addConfiguredAttribute(new Manifest.Attribute("Class-Path", str
        .toString()));
    return ret;
  }
View Full Code Here

        .toString()));
    return ret;
  }

  static Manifest createDefaultManifest() throws ManifestException {
    Manifest ret = new Manifest();
    ret.addConfiguredAttribute(new Manifest.Attribute("Manifest-Version",
        "1.0"));
    ret.addConfiguredAttribute(new Manifest.Attribute("Archiver-Version",
        "Subhajit's eclipse plugin."));
    ret.addConfiguredAttribute(new Manifest.Attribute("Created-By",
        "ClassTools plugin."));
    return ret;
  }
View Full Code Here

   */
  protected static void createManifestFiles(File outputDirectory,
      EclipseProject project, String mainClass, IProgress... progresses)
      throws ManifestException, IOException, JDOMException,
      InterruptedException {
    Manifest manifest = createManifest(project, mainClass);
    saveManifest(outputDirectory, manifest);
  }
View Full Code Here

      throw new IllegalArgumentException("Run directory not given.");
    }

    // Export the process-manager.jar file to the "dir" directory.
    Class<?> klass = ProcessManagerMain.class;
    Manifest manifest = new Manifest();
    manifest.getMainSection().addConfiguredAttribute(
        new Manifest.Attribute("Premain-Class",
            ProcessManagerMain.class.getName()));
    DistributionManager.createDistributionWithAdditionalClasses(Thread
        .currentThread().getContextClassLoader(), new File(dir,
        "process-manager.jar"), manifest, klass.getName(),
View Full Code Here

TOP

Related Classes of com.subhajit.build.Manifest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.