org.apache.tools.ant.Project.addBuildListener()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.tools.ant.Project.addBuildListener()方法的一些代码示例,展示了Project.addBuildListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.addBuildListener()方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:addBuildListener

Project.addBuildListener介绍

[英]Add a build listener to the list. This listener will be notified of build events for this project.
[中]将生成侦听器添加到列表中。此侦听器将被通知此项目的生成事件。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Set the project associated with this class loader
 *
 * @param project the project instance
 */
public void setProject(Project project) {
  this.project = project;
  if (project != null) {
    project.addBuildListener(this);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Set the project associated with this class loader
 *
 * @param project the project instance
 */
public void setProject(final Project project) {
  this.project = project;
  if (project != null) {
    project.addBuildListener(this);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Set the project associated with this recorder entry.
 *
 * @param project the project instance
 *
 * @since 1.6.2
 */
public void setProject(Project project) {
  this.project = project;
  if (project != null) {
    project.addBuildListener(this);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Overridden so we can add the task as build listener.
 *
 * @since Ant 1.7
 */
public void init() {
  getProject().addBuildListener(this);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Adds the listeners specified in the command line arguments,
 * along with the default listener, to the specified project.
 *
 * @param project The project to add listeners to.
 *                Must not be <code>null</code>.
 */
protected void addBuildListeners(final Project project) {
  // Add the default listener
  project.addBuildListener(createLogger());
  final int count = listeners.size();
  for (int i = 0; i < count; i++) {
    final String className = listeners.elementAt(i);
    final BuildListener listener =
        ClasspathUtils.newInstance(className,
            Main.class.getClassLoader(), BuildListener.class);
    project.setProjectReference(listener);
    project.addBuildListener(listener);
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * @param project The Ant {@link Project}
 */
public static void addMicronautConsoleBuildListener(Project project) {
  final BuildLogger logger = new MicronautConsoleLogger();
  logger.setMessageOutputLevel(Project.MSG_INFO);
  logger.setOutputPrintStream(System.out);
  logger.setErrorPrintStream(System.err);
  project.addBuildListener(logger);
  MicronautConsole instance = MicronautConsole.getInstance();
  project.addBuildListener(new ConsoleBuildListener(instance));
  if (!instance.isVerbose()) {
    for (Object buildListener : project.getBuildListeners()) {
      if (buildListener instanceof BuildLogger) {
        ((BuildLogger) buildListener).setMessageOutputLevel(LogLevel.ERR.getLevel());
      }
    }
  }
}

代码示例来源:origin: apache/groovy

/**
 * @return Factory method to create new Project instances
 */
protected static Project createProject() {
  final Project project = new Project();
  final ProjectHelper helper = ProjectHelper.getProjectHelper();
  project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
  helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty 
  final BuildLogger logger = new NoBannerLogger();
  logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
  logger.setOutputPrintStream(System.out);
  logger.setErrorPrintStream(System.err);
  project.addBuildListener(logger);
  project.init();
  project.getBaseDir();
  return project;
}

代码示例来源:origin: org.apache.ant/ant

getProject().addBuildListener(this);
} else {

代码示例来源:origin: org.apache.ant/ant

newProject.setInputHandler(getProject().getInputHandler());
getProject().getBuildListeners().forEach(bl -> newProject.addBuildListener(bl));
    logger.setOutputPrintStream(out);
    logger.setErrorPrintStream(out);
    newProject.addBuildListener(logger);
  } catch (IOException ex) {
    log("Ant: Can't set output to " + output);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Set the project associated with this class loader
 *
 * @param project the project instance
 */
public void setProject(Project project) {
  this.project = project;
  if (project != null) {
    project.addBuildListener(this);
  }
}

代码示例来源:origin: org.rundeck/rundeck-core

public static void addAntBuildListener(ExecutionListener listener, Project project) {
    final ExecutionListenerBuildLogger listener1 = new ExecutionListenerBuildLogger(listener);
    project.addBuildListener(listener1);
  }
}

代码示例来源:origin: org.seleniumhq.selenium.server/selenium-server-coreless

public AsyncExecute() {
  project = new Project();
  project.addBuildListener(new AntJettyLoggerBuildListener(log));
  environmentBuilder = new HashMap<String, String>(2);
}

代码示例来源:origin: com.xpn.xwiki.platform.tools/xwiki-shared-tests

public XWikiTestSetup(Test test)
{
  super(test);
  this.project = new Project();
  this.project.init();
  this.project.addBuildListener(new AntBuildListener(DEBUG));
}

代码示例来源:origin: maven-nar/nar-maven-plugin

protected final Project getAntProject() {
 if (this.antProject == null) {
  // configure ant project
  this.antProject = new Project();
  this.antProject.setName("NARProject");
  this.antProject.addBuildListener(new NarLogger(getLog()));
 }
 return this.antProject;
}

代码示例来源:origin: org.gosu-lang.aardvark/aardvark-core

public static void setProject(Project project, BuildLogger logger) {
 _antProjectInstance = project;
 if (logger != null) {
  project.removeBuildListener(_logger);
  _logger = logger;
  logger.setMessageOutputLevel(Project.MSG_INFO);
  logger.setOutputPrintStream(System.out);
  logger.setErrorPrintStream(System.err);
  project.addBuildListener(logger);
 }
}

代码示例来源:origin: stackoverflow.com

Project p = new Project();
p.init();
p.addBuildListener( new SimpleBuildListener() );
p.setBaseDir( new File( "." ).getAbsoluteFile() );

Javac task = (Javac) p.createTask( "javac" );
task.srcdir( srcDirPath );

// Filsets can be built this way
FileSet set = new FileSet();
set.setDir( srcDirPath );
set.setIncludes( "**/*.java" );

task.addFileset( set );

代码示例来源:origin: liferay/liferay-faces

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;
}

代码示例来源:origin: org.testatoo.openqa/selenium-server

protected void downloadWithAnt(final URL url, final File outputFile) {
  Project p = new Project();
  p.addBuildListener(new AntJettyLoggerBuildListener(LOGGER));
  Get g = new Get();
  g.setProject(p);
  g.setSrc(url);
  g.setDest(outputFile);
  g.execute();
}

代码示例来源:origin: org.seleniumhq.selenium.server/selenium-server-coreless

protected void downloadWithAnt(final URL url, final File outputFile) {
  Project p = new Project();
  p.addBuildListener(new AntJettyLoggerBuildListener(LOGGER));
  Get g = new Get();
  g.setProject(p);
  g.setSrc(url);
  g.setDest(outputFile);
  g.execute();
}

代码示例来源:origin: org.gradle/gradle-core

public DefaultAntBuilder create() {
  AntLoggingAdapter loggingAdapter = loggingAdapterFactory.create();
  DefaultAntBuilder antBuilder = new DefaultAntBuilder(project, loggingAdapter);
  antBuilder.getProject().setBaseDir(project.getProjectDir());
  antBuilder.getProject().removeBuildListener(antBuilder.getProject().getBuildListeners().get(0));
  antBuilder.getProject().addBuildListener(loggingAdapter);
  stoppable.add(antBuilder);
  return antBuilder;
}

相关文章