Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Manifest$Attribute


    project.setName(resource.getName());
    project.setBasedir(resource.getLocation().toString());
    Copy copy=new Copy();
    copy.setOverwrite(true);
    copy.setProject(project);
    Manifest manifest = getManifest(resource);
    String bundelName=genarateFullName(manifest).toString();
    File bundelFile=new File(bundelName);
    if(!bundelFile.exists()){
      bundelFile.mkdirs();
    }
View Full Code Here


  protected Manifest getManifest(IProject model){
    try {
      IFile manifestMf=model.getFile(Constants.MANIFEST_MF);
      InputStreamReader reader =
          new InputStreamReader(manifestMf.getContents());
      Manifest manifest = new Manifest(reader);
      reader.close();
      return manifest;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

            InputStream is = OneJarTask.class.getResourceAsStream(ONE_JAR_BOOT);
            if (is == null)
                throw new IOException("Unable to load default " + ONE_JAR_BOOT + ": consider using the <one-jar onejarboot=\"...\"> option.");
            // Pull the manifest out and use it.
            JarInputStream jis = new JarInputStream(is);
            Manifest manifest = new Manifest();
            java.util.jar.Manifest jmanifest = jis.getManifest();
            java.util.jar.Attributes jattributes = jmanifest.getMainAttributes();
            try {
                // Specify our Created-By and Main-Class attributes as overrides.
                manifest.addConfiguredAttribute(new Attribute("Created-By", "One-Jar 0.98 Ant taskdef"));
                manifest.addConfiguredAttribute(new Attribute(MAIN_CLASS, jattributes.getValue(MAIN_CLASS)));
                if (oneJarMainClass != null) {
                    manifest.addConfiguredAttribute(new Attribute(Boot.ONE_JAR_MAIN_CLASS, oneJarMainClass));
                }
                super.addConfiguredManifest(manifest);
            } catch (ManifestException mx) {
                throw new BuildException(mx);
            }
View Full Code Here

        if (manifestFiles.size() != 0)
        {
            //
            // Create a default (empty) manifest
            //
            Manifest mergeManifest = Manifest.getDefaultManifest();

            //
            // Iterate through each found manifest file, merging its contents into the
            // merge manifest
            //
            for (File manifestFile : manifestFiles)
            {
                FileInputStream fis = null;
                try
                {
                    fis = new FileInputStream(manifestFile);
                    Manifest resourceManifest = new Manifest(new InputStreamReader(fis));
                    mergeManifest.merge(resourceManifest);
                }
                catch (IOException ioe)
                {
                    throw new BuildException("Unable to read manifest file:" + manifestFile, ioe);
View Full Code Here

        if (manifestFiles.size() != 0)
        {
            //
            // Create a default (empty) manifest
            //
            Manifest mergeManifest = Manifest.getDefaultManifest();

            //
            // Iterate through each found manifest file, merging its contents into the
            // merge manifest
            //
            for (File manifestFile : manifestFiles)
            {
                FileInputStream fis = null;
                try
                {
                    fis = new FileInputStream(manifestFile);
                    Manifest resourceManifest = new Manifest(new InputStreamReader(fis));
                    mergeManifest.merge(resourceManifest);
                }
                catch (IOException ioe)
                {
                    throw new BuildException("Unable to read manifest file:" + manifestFile, ioe);
View Full Code Here

            InputStream is = OneJarTask.class.getResourceAsStream(ONE_JAR_BOOT);
            if (is == null)
                throw new IOException("Unable to load default " + ONE_JAR_BOOT + ": consider using the <one-jar onejarboot=\"...\"> option.");
            // Pull the manifest out and use it.
            JarInputStream jis = new JarInputStream(is);
            Manifest manifest = new Manifest();
            java.util.jar.Manifest jmanifest = jis.getManifest();
            java.util.jar.Attributes jattributes = jmanifest.getMainAttributes();
            try {
                // Specify our Created-By and Main-Class attributes as overrides.
                manifest.addConfiguredAttribute(new Attribute("Created-By", "One-Jar 0.96 Ant taskdef"));
                manifest.addConfiguredAttribute(new Attribute(MAIN_CLASS, jattributes.getValue(MAIN_CLASS)));
                if (oneJarMainClass != null) {
                    manifest.addConfiguredAttribute(new Attribute(Boot.ONE_JAR_MAIN_CLASS, oneJarMainClass));
                }
                super.addConfiguredManifest(manifest);
            } catch (ManifestException mx) {
                throw new BuildException(mx);
            }
View Full Code Here

        init();
        return this;
    }

    private Manifest generateAntManifest() {
        Manifest antManifest = new Manifest();
        addAttributesToAnt(antManifest);
        addSectionAttributesToAnt(antManifest);
        return antManifest;
    }
View Full Code Here

    private void read(Object manifestPath) {
        File manifestFile = fileResolver.resolve(manifestPath);
        try {
            FileReader reader = new FileReader(manifestFile);
            Manifest antManifest;
            try {
                antManifest = new Manifest(reader);
            } finally {
                reader.close();
            }
            addAntManifestToAttributes(antManifest);
            addAntManifestToSections(antManifest);
View Full Code Here

        }
      }

      // set the source jar manifest
      try {
        Manifest mft = new Manifest();
        configureManifest(mft);
        jar.addConfiguredManifest(mft);
      } catch (ManifestException e) {
        console.error(e);
      }
View Full Code Here

  }

  @Override
  protected void configureManifest(Manifest manifest) {
    // set manifest entries from Moxie metadata
    Manifest mft = new Manifest();
    setManifest(mft, "Manifest-Version", "1.0");
    setManifest(mft, "Created-By", "Moxie v" + Toolkit.getVersion());
    setManifest(mft, "Build-Jdk", System.getProperty("java.version"));
    setManifest(mft, "Build-Date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));

    setManifest(mft, "Implementation-Title", Key.name);
    setManifest(mft, "Implementation-Vendor", Key.organization);
    setManifest(mft, "Implementation-Vendor-Id", Key.groupId);
    setManifest(mft, "Implementation-Vendor-URL", Key.url);
    setManifest(mft, "Implementation-Version", Key.version);

    setManifest(mft, "Bundle-Name", Key.name);
    setManifest(mft, "Bundle-SymbolicName", Key.artifactId);
    setManifest(mft, "Bundle-Version", Key.version);
    setManifest(mft, "Bundle-Vendor", Key.organization);

    setManifest(mft, "Maven-Url", Key.mavenUrl);
    setManifest(mft, "Commit-Id", Key.commitId);

    if (main.getManifest() == null) {
      // set the manifest of the embedded main jar
      try {
        File file = File.createTempFile("moxie-", ".mft");
        FileOutputStream os = new FileOutputStream(file);
        PrintWriter writer = new PrintWriter(os);
        mft.write(writer);
        writer.flush();
        os.close();
        main.setManifest(file);
      } catch (FileNotFoundException e) {
        console.error(e, "Failed to set main.jar manifest!");
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Manifest$Attribute

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.