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() );