Search in sources :

Example 6 with DefaultLogger

use of org.apache.tools.ant.DefaultLogger in project Gargoyle by callakrsos.

the class AntJavaCompiler method parse.

/**
	 *
	 * build.xml파일을 파싱처리하여
	 * 빌드처리 준비상태로 처리한다.
	 * 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2017. 3. 7.
	 */
public void parse() {
    p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    p.setUserProperty("encoding", encoding.displayName());
    p.init();
    helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    if (baseDir != null && baseDir.exists())
        p.setBaseDir(baseDir);
    else
        p.setBaseDir(buildFile.getParentFile());
    //setting console
    DefaultLogger consoleLogger = getLogger();
    consoleLogger.setOutputPrintStream(new PrintStream(out));
    consoleLogger.setErrorPrintStream(new PrintStream(err));
    consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
    p.addBuildListener(consoleLogger);
    //parse build.xml
    helper.parse(p, buildFile);
    LOGGER.debug("  ##### base dir : " + p.getBaseDir());
    LOGGER.debug("  ##### default target : " + p.getDefaultTarget());
    //append build debugger.
    BuildListener buildListener = getBuildListener();
    if (buildListener != null)
        p.addBuildListener(buildListener);
    wasParse = true;
}
Also used : Project(org.apache.tools.ant.Project) PrintStream(java.io.PrintStream) BuildListener(org.apache.tools.ant.BuildListener) DefaultLogger(org.apache.tools.ant.DefaultLogger)

Aggregations

DefaultLogger (org.apache.tools.ant.DefaultLogger)6 Project (org.apache.tools.ant.Project)5 PrintStream (java.io.PrintStream)3 File (java.io.File)2 IOException (java.io.IOException)2 BuildException (org.apache.tools.ant.BuildException)2 StreamTaskListener (hudson.util.StreamTaskListener)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DependencyResolutionRequiredException (org.apache.maven.artifact.DependencyResolutionRequiredException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MavenProject (org.apache.maven.project.MavenProject)1 BuildListener (org.apache.tools.ant.BuildListener)1 ProjectHelper (org.apache.tools.ant.ProjectHelper)1 Move (org.apache.tools.ant.taskdefs.Move)1 FileSet (org.apache.tools.ant.types.FileSet)1 Path (org.apache.tools.ant.types.Path)1