Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Jar


        // Check if we have to do something
        if (isUpToDate(descriptor, descr, destFile))
            return;

        final Jar jarTask = new Jar();
        jarTask.setProject(getProject());
        jarTask.setTaskName(getTaskName());
        jarTask.setDestFile(destFile);
        jarTask.setCompress(false);

        // Add plugin.xml
        final File tmpPluginDir;
        final File tmpPluginXmlFile;
        try {
            tmpPluginDir = new File(tmpDir, "jnode-plugins" + File.separator + fullId);
            tmpPluginDir.mkdirs();
            tmpPluginXmlFile = new File(tmpPluginDir, "plugin.xml");
            FileUtils.newFileUtils().copyFile(descriptor, tmpPluginXmlFile);
            FileSet fs = new FileSet();
            fs.setDir(tmpPluginDir);
            fs.createInclude().setName("plugin.xml");
            jarTask.addFileset(fs);
        } catch (IOException ex) {
            throw new BuildException(ex);
        }

        // Create manifest
        try {
            jarTask.addConfiguredManifest(createManifest(descr));
        } catch (ManifestException ex) {
            throw new BuildException(ex);
        }

        // Add runtime resources
        final Runtime rt = descr.getRuntime();
        if (rt != null) {
            final HashMap<File, ZipFileSet> fileSets = new HashMap<File, ZipFileSet>();
            final Library[] libs = rt.getLibraries();
            for (int l = 0; l < libs.length; l++) {
                processLibrary(jarTask, libs[l], fileSets, getPluginDir());
            }
        }

        jarTask.execute();
    }
View Full Code Here


            /*
             * final PluginRegistry piRegistry; piRegistry = new
             * PluginRegistryModel(piList.getDescriptorUrlList());
             */

            final Jar jarTask = new Jar();
            jarTask.setProject(getProject());
            jarTask.setTaskName(getTaskName());
            jarTask.setDestFile(tmpFile);
            jarTask.setCompress(false);

            final Manifest mf = piList.getManifest();
            if (mf != null) {
                jarTask.addConfiguredManifest(mf);
            }

            final URL[] systemPlugins = systemPluginList.getPluginList();
            final ArrayList<PluginJar> pluginJars = new ArrayList<PluginJar>();
            for (URL url : systemPlugins) {
                final BuildPluginJar piJar = new BuildPluginJar(url);
                if (!piJar.getDescriptor().isSystemPlugin()) {
                    log("Non-system plugin " + piJar.getDescriptor().getId()
                        + " in plugin-list will be ignored",
                        Project.MSG_WARN);
                } else {
                    pluginJars.add(piJar);
                }
            }

            final URL[] pluginList = piList.getPluginList();
            for (URL url : pluginList) {
                final BuildPluginJar piJar = new BuildPluginJar(url);
                if (piJar.getDescriptor().isSystemPlugin()) {
                    log("System plugin " + piJar.getDescriptor().getId()
                        + " in plugin-list will be ignored",
                        Project.MSG_WARN);
                } else {
                    pluginJars.add(piJar);
                }
            }
            testPluginPrerequisites(pluginJars);
            final List<PluginJar> sortedPluginJars = sortPlugins(pluginJars);

            for (Iterator<PluginJar> i = sortedPluginJars.iterator(); i
                .hasNext();) {
                final BuildPluginJar piJar = (BuildPluginJar) i.next();
                if (!piJar.getDescriptor().isSystemPlugin()) {
//                    pluginJars.add(piJar);
                    final File f = new File(piJar.getPluginUrl().getPath());
                    final FileSet fs = new FileSet();
                    fs.setDir(f.getParentFile());
                    fs.setIncludes(f.getName());
                    jarTask.addFileset(fs);
                }
            }

            /*
             * for (Iterator i = piRegistry.getDescriptorIterator();
             * i.hasNext(); ) { final PluginDescriptor descr =
             * (PluginDescriptor)i.next(); final Runtime rt =
             * descr.getRuntime(); if (rt != null) { final Library[] libs =
             * rt.getLibraries(); for (int l = 0; l < libs.length; l++) {
             * processLibrary(jarTask, libs[l], fileSets, getPluginDir()); } }
             */

            // Now create the jar file
            jarTask.execute();

            // Now zip it
            final GZip gzipTask = new GZip();
            gzipTask.setProject(getProject());
            gzipTask.setTaskName(getTaskName());
View Full Code Here

    private void createResourceJar(File tmpFile) throws IOException,
            ManifestException {
        String contentToken = calculateContentToken();
        Manifest mf = buildManifest(contentToken);

        Jar jar = new Jar();
        jar.bindToOwner(this);
        jar.addConfiguredManifest(mf);
        for (FileSet fs : filesets)
            jar.addFileset(fs);

        tmpFile.delete();
        jar.setDestFile(tmpFile);
        jar.execute();
    }
View Full Code Here

            packageAdmin.refreshPackages(null);
        }
    }

    protected File createBundleJar(File dir) throws BundleException, IOException {
        Jar jar = new Jar();
        jar.setProject(project);
        File destFile = new File(generateDir, dir.getName() + ".jar");
        if (destFile.exists()) {
            undeployBundle(destFile);
            destFile.delete();
        }
        LOGGER.info("Creating jar:  " + destFile + " from dir: " + dir);
        jar.setDestFile(destFile);
        jar.setManifest(new File(new File(dir, "META-INF"), "MANIFEST.MF"));
        jar.setBasedir(dir);

        jar.init();
        jar.perform();
        return destFile;
    }
View Full Code Here

                    log("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds");

                if (destfile != null)
                {
                    // jar the compiled classes
                    Jar jar = new Jar();
                    jar.setProject(project);
                    jar.setTaskName(getTaskName());
                    jar.setBasedir(classgendir);
                    jar.setDestFile(destfile);
                    jar.execute();
                }
            }

            if (tmpdir != null) {
                SchemaCodeGenerator.tryHardToDelete(tmpdir);
View Full Code Here

                    log("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds");

                if (destfile != null)
                {
                    // jar the compiled classes
                    Jar jar = new Jar();
                    jar.setProject(project);
                    jar.setTaskName(getTaskName());
                    jar.setBasedir(classgendir);
                    jar.setDestFile(destfile);
                    jar.execute();
                }
            }

            if (tmpdir != null) {
                SchemaCodeGenerator.tryHardToDelete(tmpdir);
View Full Code Here

        // deploy the web-app by copying the WAR file into the applications
        // directory, adding the weblogic.xml descriptor in WEB-INF
        File applicationsDir =
            createDirectory(testDomainDir, "applications");
        Jar jar = (Jar) createAntTask("jar");
        jar.setDestFile(new File(applicationsDir,
            getDeployableFile().getFile().getName()));
        ZipFileSet zip = new ZipFileSet();
        zip.setSrc(getDeployableFile().getFile());
        jar.addZipfileset(zip);
        ZipFileSet fileSet = new ZipFileSet();
        fileSet.setDir(this.tmpDir);
        fileSet.createInclude().setName("weblogic.xml");
        fileSet.setPrefix("WEB-INF");
        jar.addZipfileset(fileSet);
        jar.execute();
    }
View Full Code Here

    // mark class file to bundle.
    Project project = new Project();
    project.setName(resource.getName());
    project.setBasedir(resource.getLocation().toString());
    // creat jar
    Jar jar = new Jar();
    Manifest manifest = getManifest(resource);
    try {
      jar.addConfiguredManifest(manifest);
    } catch (ManifestException e) {
      e.printStackTrace();
      return null;
    }
    jar.setProject(project);
    String outPut=BuiderParameter.getProjectOutput(resource);
    File baseDir=new File(project.getBaseDir(),outPut);
    jar.setBasedir(baseDir);
    // destination .
    String bundleName = genarateFullExtName(manifest);
    Console.println("Bublish Project "+resource.getName()+" As Bundel To : "+bundleName);
    jar.setDestFile(new File(bundleName));
    // extend set.
    FileSet fileSet=getFileSet(project,resource);
    jar.addFileset(fileSet);
    jar.execute();
    return bundleName;
  }
View Full Code Here

                    log("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds");

                if (destfile != null)
                {
                    // jar the compiled classes
                    Jar jar = new Jar();
                    jar.setProject(project);
                    jar.setTaskName(getTaskName());
                    jar.setBasedir(classgendir);
                    jar.setDestFile(destfile);
                    jar.execute();
                }
            }

            if (tmpdir != null) {
                SchemaCodeGenerator.tryHardToDelete(tmpdir);
View Full Code Here

        // deploy the web-app by copying the WAR file into the applications
        // directory, adding the weblogic.xml descriptor
        File applicationsDir =
            createDirectory(testDomainDir, "applications");
        Jar jar = (Jar) createAntTask("jar");
        jar.setDestFile(new File(applicationsDir,
            getDeployableFile().getName()));
        ZipFileSet zip = new ZipFileSet();
        zip.setSrc(getDeployableFile());
        jar.addZipfileset(zip);
        FileSet fileSet = new FileSet();
        fileSet.setDir(this.tmpDir);
        fileSet.createInclude().setName("weblogic.xml");
        jar.addFileset(fileSet);
        jar.execute();
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Jar

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.