當前位置: 首頁>>代碼示例>>Java>>正文


Java Project.addBuildListener方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.Project.addBuildListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.addBuildListener方法的具體用法?Java Project.addBuildListener怎麽用?Java Project.addBuildListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.Project的用法示例。


在下文中一共展示了Project.addBuildListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: altCompile

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Description: compile method that does not maintains the i/o streams after the task is done.
 * This is an alternative for the current compile method for future uses.
 * @param file path of the build xml to be executed
 */
public static void altCompile( String file) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    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();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
      
    } catch (Exception e) {}
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:29,代碼來源:BuildSys.java

示例2: createProject

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * @return Factory method to create new Project instances
 */
public 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

    project.addBuildListener(new AntLoggingAdapter());

    project.init();
    project.getBaseDir();
    return project;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:AntUtil.java

示例3: compile

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Description: compile method that maintains the i/o streams after the task is done.
 * @param file path of the build xml to be executed
 * @param out current output stream
 * @param err current input stream
 */
public static void compile( String file, PrintStream out, PrintStream err) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    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();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
        System.setErr(err);
        System.setOut(out);
        
        
    } catch (Exception e) {}
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:34,代碼來源:BuildSys.java

示例4: LangtoolsIdeaAntLogger

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public LangtoolsIdeaAntLogger(Project project) {
    for (Object o : project.getBuildListeners()) {
        if (o instanceof DefaultLogger) {
            this.logger = (DefaultLogger)o;
            project.removeBuildListener((BuildListener)o);
            project.addBuildListener(this);
        }
    }
    logger.setMessageOutputLevel(3);
    tasks.push(Task.ROOT);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:LangtoolsIdeaAntLogger.java

示例5: JdkIdeaAntLogger

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public JdkIdeaAntLogger(Project project) {
    for (Object o : project.getBuildListeners()) {
        if (o instanceof DefaultLogger) {
            this.logger = (DefaultLogger)o;
            project.removeBuildListener((BuildListener)o);
            project.addBuildListener(this);
        }
    }
    tasks.push(Task.ROOT);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:JdkIdeaAntLogger.java

示例6: execute

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public void execute()
    throws MojoExecutionException
{

    if ( ! destDirectory.exists() && ! destDirectory.mkdirs() ) {
       getLog().warn( "the destination directory doesn't exists and couldn't be created. The goal with probably fail." );
    }

    final Project antProject = new Project();

    antProject.addBuildListener(new DebugAntBuildListener());

    final Javac2 task = new Javac2();

    task.setProject( antProject );

    task.setDestdir( destDirectory );

    task.setFailonerror( failOnError );

    final Path classpath = new Path( antProject );

    final Collection artifacts = project.getDependencyArtifacts();

    for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
        final Artifact artifact = (Artifact) iterator.next();
        if ( ! "jar".equals( artifact.getType() ) || Artifact.SCOPE_TEST.equals(artifact.getScope()))
          continue;

        classpath.createPathElement().setLocation( artifact.getFile() );
    }

    File rtJar = new File(System.getProperty("java.home") + "/lib", "rt.jar");
    classpath.createPathElement().setLocation(rtJar);

    classpath.createPathElement().setLocation( destDirectory );

    getLog().debug( "created classpath:" + classpath );

    task.setClasspath( classpath );

    task.setFork( fork );

    // task.setMemoryInitialSize();

    // task.setMemoryMaximumSize()

    task.setDebug( debug );

    task.setVerbose( verbose );

    task.setSrcdir( new Path( antProject, sourceDirectory.getAbsolutePath() ) );

    task.setIncludes( "**/*.form" );

    getLog().info( "Executing IDEA UI Designer task..." );

    try
    {
        task.execute();
    }
    catch ( BuildException e )
    {
        throw new MojoExecutionException( "command execution failed", e );
    }
}
 
開發者ID:jorichard,項目名稱:ideauidesigner-maven-plugin,代碼行數:67,代碼來源:Javac2Mojo.java


注:本文中的org.apache.tools.ant.Project.addBuildListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。