Package org.apache.tools.ant.taskdefs

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


   * Method copyLibs.
   *
   * @throws BuildException
   */
  protected void copyLibs() throws BuildException {
    Copy cp = this.getSubtaskFactory().getResourceCopy();
    cp.setTodir(new File(resourcesDir(), "Java"));
    cp.setFlatten(true);

    Enumeration<FileSet> en = lib.elements();
    while (en.hasMoreElements()) {
      cp.addFileset((FileSet) en.nextElement());
    }
    cp.execute();
  }
View Full Code Here


    new TokenFilter(tokens).copy("japplication/mac/Info.plist", targetInfoPlist);
  }

  void copyStub() throws BuildException {
    Copy cp = (Copy) task.createSubtask(Copy.class);
    cp.setTodir(macOSDir);
    cp.setFile(stub);
    cp.execute();

    Chmod chmod = (Chmod) task.createSubtask(Chmod.class);
    chmod.setPerm("755");
    chmod.setFile(new File(macOSDir, "JavaApplicationStub"));
    chmod.execute();
View Full Code Here

    chmod.execute();
  }

  void copyIcon() throws BuildException {
    if (task.getIcon() != null && task.getIcon().isFile()) {
      Copy cp = (Copy) task.createSubtask(Copy.class);
      cp.setTodir(resourcesDir);
      cp.setFile(task.getIcon());
      cp.execute();
    }
  }
View Full Code Here

    }
  }

  void copyJars() {
    if (!task.getLibs().isEmpty()) {
      Copy cp = (Copy) task.createSubtask(Copy.class);
      cp.setTodir(javaDir);
      cp.setFlatten(true);

      Iterator it = task.getLibs().iterator();
      while (it.hasNext()) {
        FileSet fs = (FileSet) it.next();
        cp.addFileset(fs);
      }

      cp.execute();
    }
  }
View Full Code Here

          System.out.println("WOApplication.copyEmbeddedFrameworks:   directory = " + directory);
        }
      }
    }
    else {
      Copy cp = new Copy();
      cp.setOwningTarget(getOwningTarget());
      cp.setProject(getProject());
      cp.setTaskName(getTaskName());
      cp.setLocation(getLocation());

      cp.setTodir(embeddedFrameworksDir());

      // The purpose of this is to create filesets that actually
      // allow the framework directory to be copied into the
      // WOApplication directory. If we didn't do this, we'd
      // have to append '/' or '/**' to the end of the includes
      // in the <frameworks> tag.
      boolean hasEmbeddedFrameworkSets = false;
      for (FrameworkSet frameworkSet : getFrameworkSets()) {
        if (!frameworkSet.getEmbed()) {
          continue;
        }

        File root = frameworkSet.getDir(getProject());
        DirectoryScanner directoryScanner = frameworkSet.getDirectoryScanner(getProject());
        String[] directories = directoryScanner.getIncludedDirectories();
        for (String directory : directories) {
          if (!directory.endsWith(".framework")) {
            throw new BuildException("The includeded directory '" + directory + "' must end with '.framework'");
          }

          FileSet newFileSet = new FileSet();
          newFileSet.setDir(root);
          PatternSet.NameEntry include = newFileSet.createInclude();
          include.setName(directory + "/**");

          cp.addFileset(newFileSet);
          hasEmbeddedFrameworkSets = true;
        }
      }
      if (hasEmbeddedFrameworkSets) {
        cp.execute();
      }
    }
  }
View Full Code Here

   * Method copyEmbeddedFrameworks.
   *
   * @throws BuildException
   */
  protected void copyEmbeddedOtherClasspaths() throws BuildException {
    Copy cp = new Copy();
    cp.setOwningTarget(getOwningTarget());
    cp.setProject(getProject());
    cp.setTaskName(getTaskName());
    cp.setLocation(getLocation());

    cp.setTodir(contentsDir());

    boolean hasSet = false;
    for (OtherClasspathSet cs : getOtherClasspath()) {
      if (cs.getEmbed() == false) {
        continue;
      }

      File root = cs.getDir(getProject());
      DirectoryScanner ds = cs.getDirectoryScanner(getProject());
      for (String includeName : ds.getIncludedDirectories()) {
        FileSet newCs = new FileSet();
        PatternSet.NameEntry include;

        newCs.setDir(root);
        include = newCs.createInclude();

        // Since we're embedding, we expect to copy the entire subtree
        // for this included entry. Force it if the task user didn't.
        if (includeName.endsWith("/") == false) {
          includeName = includeName + "/";
        }
        include.setName(includeName);

        cp.addFileset(newCs);
        hasSet = true;
      }
    }
    if (hasSet)
      cp.execute();
  }
View Full Code Here

  private String filePath;
  private String newName;
  private Copy copyTask;

  public RenamedFileContainer() {
    copyTask = new Copy();
    copyTask.setTaskName("copy");
  }
View Full Code Here

        return Collections.emptyList();
    }

    private void copySet(LayoutFileSet set) {
        Copy task = new Copy();
        task.setTaskName("copy");
        task.setProject(getProject());
        String prefix = set.getPrefix(getProject());
        File target = prefix.length() > 0 ? new File(destDirectory, prefix + "/") : destDirectory;

        target.mkdirs();

        task.setTodir(target);
        LayoutFileSet unprefixed = (LayoutFileSet) set.clone();
        unprefixed.setPrefix("");

        task.addFileset(unprefixed);
        task.perform();
    }
View Full Code Here

        if (!_builddir.mkdirs() || !_cachedir.mkdirs()) {
            throw new Exception("can't create directories under " + _workdir);
        }

        // copy "website"
        Copy copy = new Copy();
        FileSet fileSet = new FileSet();
        fileSet.setDir(new File("test/repositories/packager/website"));
        copy.addFileset(fileSet);
        copy.setTodir(_websitedir);
        copy.setProject(new Project());
        copy.execute();
    }
View Full Code Here

            computedConfigDir = this.configDir;
        }
       
        // Copy the default JBoss server config directory into our custom
        // server directory.
        Copy copy = new Copy();
        copy.setTaskName("cactus");
        copy.setProject(getProject());
        copy.setTodir(theCustomServerDir);
        FileSet srcFiles = new FileSet();
        srcFiles.setDir(new File(computedConfigDir, this.config));
        copy.addFileset(srcFiles);
        copy.execute();
           
        // Deploy the web-app by copying the WAR file into the webapps
        // directory
        File deployDir = new File(theCustomServerDir, "/deploy");
        fileUtils.copyFile(getDeployableFile().getFile(),
View Full Code Here

TOP

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

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.