Package org.apache.tools.ant

Examples of org.apache.tools.ant.DefaultLogger


    public void testAntUnit() throws BuildException {

        File buildFile = new File("test/src/ant/build.xml");
        Project p = new  Project();
        p.setUserProperty("ant.file", buildFile.getAbsolutePath());
        DefaultLogger consoleLogger = new DefaultLogger();
        consoleLogger.setErrorPrintStream(System.err);
        consoleLogger.setOutputPrintStream(System.out);
        consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
        p.addBuildListener(consoleLogger);
        try {
            p.fireBuildStarted();
            p.init();
            ProjectHelper helper = ProjectHelper.getProjectHelper();
View Full Code Here


    public void launch(boolean spawn) {
        final String home = System.getProperty("exist.home", ".");
        final Project project = new Project();
        project.setBasedir(home);
        final DefaultLogger logger = new DefaultLogger();
        logger.setOutputPrintStream(System.out);
        logger.setErrorPrintStream(System.err);
        logger.setMessageOutputLevel(Project.MSG_DEBUG);
        project.addBuildListener(logger);

        final Java java = new Java();
        java.setFork(true);
        java.setSpawn(spawn);
View Full Code Here

            } else {
                outfile = getProject().resolveFile(output);
            }
            try {
                out = new PrintStream(new FileOutputStream(outfile));
                DefaultLogger logger = new DefaultLogger();
                logger.setMessageOutputLevel(Project.MSG_INFO);
                logger.setOutputPrintStream(out);
                logger.setErrorPrintStream(out);
                newProject.addBuildListener(logger);
            } catch (IOException ex) {
                log("Ant: Can't set output to " + output);
            }
        }
View Full Code Here

            } else {
                outfile = getProject().resolveFile(output);
            }
            try {
                out = new PrintStream(new FileOutputStream(outfile));
                DefaultLogger logger = new DefaultLogger();
                logger.setMessageOutputLevel(Project.MSG_INFO);
                logger.setOutputPrintStream(out);
                logger.setErrorPrintStream(out);
                newProject.addBuildListener(logger);
            } catch (IOException ex) {
                log("Ant: Can't set output to " + output);
            }
        }
View Full Code Here

                "You must set the "
                                + ACTIVEMQ_HOME
                                + " system property to the root path of an ActiveMq distribution (v3.0 and greater) before running these tests");
        }
        Project project = new Project();
        DefaultLogger consoleLogger = new DefaultLogger();
        consoleLogger.setErrorPrintStream(System.err);
        consoleLogger.setOutputPrintStream(System.out);
        consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
        project.addBuildListener(consoleLogger);
        Path path = new Path(project);
        File[] jars = FileUtils.newFile(activeMqHome + "\\lib").listFiles(new FilenameWildcardFilter("*.jar"));
        path.add(new Path(project, FileUtils.newFile(activeMqHome, "\\conf").getAbsolutePath()));
        for (int i = 0; i < jars.length; i++)
View Full Code Here

public class AntUtil {

  public static Project getProject() {
    Project project = new Project();

    BuildLogger buildLogger = new DefaultLogger();

    buildLogger.setErrorPrintStream(System.err);
    buildLogger.setMessageOutputLevel(Project.MSG_INFO);
    buildLogger.setOutputPrintStream(System.out);

    project.addBuildListener(buildLogger);

    return project;
  }
View Full Code Here

    assertTrue(RepositoryCache.FileKey.isGitRepository(dest, FS.DETECTED));
  }

  private void enableLogging() {
    DefaultLogger logger = new DefaultLogger();
    logger.setOutputPrintStream(System.out);
    logger.setErrorPrintStream(System.err);
    logger.setMessageOutputLevel(Project.MSG_INFO);
    project.addBuildListener(logger);
  }
View Full Code Here

            Project antProject = new Project();
            try
            {
                antProject.setBaseDir(MavenTestingUtils.getBasedir());
                antProject.setUserProperty("ant.file",buildFile.getAbsolutePath());
                DefaultLogger logger = new DefaultLogger();

                ConsoleParser parser = new ConsoleParser();
                //connList = parser.newPattern(".*([0-9]+\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)",1);
                connList = parser.newPattern("Jetty AntTask Started",1);

                PipedOutputStream pos = new PipedOutputStream();
                PipedInputStream pis = new PipedInputStream(pos);

                PipedOutputStream pose = new PipedOutputStream();
                PipedInputStream pise = new PipedInputStream(pose);

                startPump("STDOUT",parser,pis);
                startPump("STDERR",parser,pise);
               
                logger.setErrorPrintStream(new PrintStream(pos));
                logger.setOutputPrintStream(new PrintStream(pose));
                logger.setMessageOutputLevel(Project.MSG_VERBOSE);
                antProject.addBuildListener(logger);

                antProject.fireBuildStarted();
                antProject.init();

View Full Code Here

            Project antProject = new Project();
            File antBuildFile = this.writeTargetToProjectFile( );
            ProjectHelper.configureProject( antProject, antBuildFile );
            antProject.init();

            DefaultLogger antLogger = new DefaultLogger();
            antLogger.setOutputPrintStream( System.out );
            antLogger.setErrorPrintStream( System.err );
           
            if ( getLog().isDebugEnabled() )
            {
                antLogger.setMessageOutputLevel( Project.MSG_DEBUG );
            }
            else if ( getLog().isInfoEnabled() )
            {
                antLogger.setMessageOutputLevel( Project.MSG_INFO );
            }
            else if ( getLog().isWarnEnabled() )
            {
                antLogger.setMessageOutputLevel( Project.MSG_WARN );
            }
            else if ( getLog().isErrorEnabled() )
            {
                antLogger.setMessageOutputLevel( Project.MSG_ERR );
            }
            else
            {
                antLogger.setMessageOutputLevel( Project.MSG_VERBOSE );
            }

            antProject.addBuildListener( antLogger );
            antProject.setBaseDir( mavenProject.getBasedir() );
View Full Code Here

      project.init();

      project.setUserProperty(MagicNames.ANT_FILE, projectFile.getAbsolutePath());
      ProjectHelper.configureProject(project, projectFile);

      listener = new DefaultLogger();
      listener.setMessageOutputLevel(Project.MSG_DEBUG);
      listener.setErrorPrintStream(ps);
      listener.setOutputPrintStream(ps);
      getProject().addBuildListener(listener);

      DefaultLogger console = new DefaultLogger();
      console.setMessageOutputLevel(Project.MSG_INFO);
      console.setErrorPrintStream(restoreSyserr);
      console.setOutputPrintStream(restoreSysout);
      getProject().addBuildListener(console);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.DefaultLogger

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.