Package org.apache.tools.ant.taskdefs

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


     * @param inDestinationDirectory The destination directory to copy to.
     * @param inPattern              The file pattern to match to locate files to copy.
     */
    protected void moveFiles(final String inSourceDirectory, final String inDestinationDirectory,
                             final String inPattern) {
        Move moveTask = (Move) antProject.createTask("move");

        FileSet fileSet = AntUtils.createFileset(inSourceDirectory, inPattern, new ArrayList());
        moveTask.setTodir(new File(inDestinationDirectory));
        moveTask.addFileset(fileSet);
        moveTask.execute();
    }
View Full Code Here


     *
     * @param from      The source file to rename.
     * @param to        The file to rename to.
     */
    protected void renameFile(final File from, final File to) {
        Move moveTask = (Move) antProject.createTask("move");

        moveTask.setFile(from);
        moveTask.setTofile(to);
        moveTask.execute();
    }
View Full Code Here

                    Runtime.getRuntime().addShutdownHook(new Thread("service starter") {
                        public void run() {
                            try {
                                if(!oldRoot.equals(installationDir)) {
                                    LOGGER.info("Moving data");
                                    Move mv = new Move();
                                    Project p = new Project();
                                    p.addBuildListener(createLogger());
                                    mv.setProject(p);
                                    FileSet fs = new FileSet();
                                    fs.setDir(oldRoot);
                                    fs.setExcludes("war/**"); // we can't really move the exploded war.
                                    mv.addFileset(fs);
                                    mv.setTodir(installationDir);
                                    mv.setFailOnError(false); // plugins can also fail to move
                                    mv.execute();
                                }
                                LOGGER.info("Starting a Windows service");
                                StreamTaskListener task = StreamTaskListener.fromStdout();
                                int r = WindowsSlaveInstaller.runElevated(
                                        new File(installationDir, "jenkins.exe"), "start", task, installationDir);
View Full Code Here

        log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
        log("</move>", Project.MSG_INFO);
        log("using the same patterns on <fileset> as you\'ve used here",
            Project.MSG_INFO);

        Move move = (Move) project.createTask("move");
        move.setOwningTarget(target);
        move.setTaskName(getTaskName());
        move.setLocation(getLocation());
        move.setTodir(srcDir);
        move.setOverwrite(replace);

        fileset.setDir(srcDir);
        move.addFileset(fileset);

        Mapper me = move.createMapper();
        me.setType(globType);
        me.setFrom("*" + fromExtension);
        me.setTo("*" + toExtension);

        move.execute();
    }
View Full Code Here

        log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
        log("</move>", Project.MSG_INFO);
        log("using the same patterns on <fileset> as you\'ve used here",
            Project.MSG_INFO);

        Move move = (Move) getProject().createTask("move");
        move.setOwningTarget(getOwningTarget());
        move.setTaskName(getTaskName());
        move.setLocation(getLocation());
        move.setTodir(srcDir);
        move.setOverwrite(replace);

        fileset.setDir(srcDir);
        move.addFileset(fileset);

        Mapper me = move.createMapper();
        me.setType(globType);
        me.setFrom("*" + fromExtension);
        me.setTo("*" + toExtension);

        move.execute();
    }
View Full Code Here

  }
    }

    public static void move(List<File> files, File destDir) throws IOException {
  try {
      Move task = new Move();
      task.setProject(new Project());
      task.setTodir(destDir);
      for (File file : files) {
    FileSet fileSet = new FileSet();
    if (file.isDirectory()) {
        fileSet.setDir(file.getParentFile());
        fileSet.setIncludes(file.getName() + "/**");
    } else {
        fileSet.setFile(file);
    }
    task.addFileset(fileSet);
      }
      task.execute();
  } catch (BuildException e) {
      throw new IOException(e);
  }
    }
View Full Code Here

        log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
        log("</move>", Project.MSG_INFO);
        log("using the same patterns on <fileset> as you\'ve used here",
            Project.MSG_INFO);

        Move move = (Move) getProject().createTask("move");
        move.setOwningTarget(getOwningTarget());
        move.setTaskName(getTaskName());
        move.setLocation(getLocation());
        move.setTodir(srcDir);
        move.setOverwrite(replace);

        fileset.setDir(srcDir);
        move.addFileset(fileset);

        Mapper me = move.createMapper();
        me.setType(globType);
        me.setFrom("*" + fromExtension);
        me.setTo("*" + toExtension);

        move.execute();
    }
View Full Code Here

    copy.execute();
  }
 
  public static void moveFile(File from, File to) throws BuildException {
    logger.info(I18N.translate("move_file"), from, to);
    Move move = new Move();
    move.setFile(from);
    move.setTofile(to);
    move.execute();
  }
View Full Code Here

        log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
        log("</move>", Project.MSG_INFO);
        log("using the same patterns on <fileset> as you\'ve used here",
            Project.MSG_INFO);

        Move move = new Move();
        move.bindToOwner(this);
        move.setOwningTarget(getOwningTarget());
        move.setTaskName(getTaskName());
        move.setLocation(getLocation());
        move.setTodir(srcDir);
        move.setOverwrite(replace);

        fileset.setDir(srcDir);
        move.addFileset(fileset);

        Mapper me = move.createMapper();
        me.setType(globType);
        me.setFrom("*" + fromExtension);
        me.setTo("*" + toExtension);

        move.execute();
    }
View Full Code Here

            out.newLine();
          }
          IOUtils.closeQuietly(in);
          IOUtils.closeQuietly(out);

          Move move = new Move();
          move.setTaskName("move");
          move.setProject(getProject());
          move.setFile(prefFileNew);
          move.setTofile(prefFile);
          move.setFailOnError(false);
          move.setForce(true);
          move.setOverwrite(true);
          move.execute();
        }catch(Exception e){
          logger.error("Error removing temp repositories.", e);
        }finally{
          IOUtils.closeQuietly(in);
          IOUtils.closeQuietly(out);
View Full Code Here

TOP

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

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.