当前位置: 首页>>代码示例>>Java>>正文


Java BuildEvent.getTask方法代码示例

本文整理汇总了Java中org.apache.tools.ant.BuildEvent.getTask方法的典型用法代码示例。如果您正苦于以下问题:Java BuildEvent.getTask方法的具体用法?Java BuildEvent.getTask怎么用?Java BuildEvent.getTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.BuildEvent的用法示例。


在下文中一共展示了BuildEvent.getTask方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = getLogLevelForMessagePriority(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:AntLoggingAdapter.java

示例2: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:AntLoggingAdapter.java

示例3: taskStarted

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#taskStarted
 * {@inheritDoc}.
 */
@Override
public void taskStarted(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (log.isTraceEnabled()) {
            realLog(log, "Task \"" + task.getTaskName() + "\" started ",
                    Project.MSG_VERBOSE, null);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:CommonsLoggingListener.java

示例4: taskFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#taskFinished
 * {@inheritDoc}.
 */
@Override
public void taskFinished(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (event.getException() == null) {
            if (log.isTraceEnabled()) {
                realLog(log, "Task \"" + task.getTaskName() + "\" finished.",
                        Project.MSG_VERBOSE, null);
            }
        } else {
            realLog(log, "Task \"" + task.getTaskName()
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:29,代码来源:CommonsLoggingListener.java

示例5: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see org.apache.tools.ant.BuildListener#messageLogged(BuildEvent)
 * {@inheritDoc}.
 */
public void messageLogged(BuildEvent event) {
    log("--- MESSAGE LOGGED", Project.MSG_DEBUG);

    StringBuffer buf = new StringBuffer();

    if (event.getTask() != null) {
        String name = event.getTask().getTaskName();

        if (!emacsMode) {
            String label = "[" + name + "] ";
            int size = DefaultLogger.LEFT_COLUMN_SIZE - label.length();

            for (int i = 0; i < size; i++) {
                buf.append(" ");
            }
            buf.append(label);
        }
    }
    buf.append(event.getMessage());

    log(buf.toString(), event.getPriority());
}
 
开发者ID:apache,项目名称:ant,代码行数:27,代码来源:RecorderEntry.java

示例6: taskStarted

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void taskStarted(BuildEvent buildEvent) {
    gatherRootModuleLocation(buildEvent.getProject(), buildEvent.getTask().getLocation());
    if (buildEvent.getTarget().getName().equals("")) {
        Task task = buildEvent.getTask();
        if (task.getTaskType() != null) {
            Class<?> taskClass = ComponentHelper.getComponentHelper(buildEvent.getProject()).getComponentClass(
                    task.getTaskType());
            if (taskClass != null) {
                for (Class<?> supportedClass : supportedClasses) {
                    if (supportedClass.isAssignableFrom(taskClass)) {
                        tasksCollected.add(task);
                    }
                }
            }
        }

    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:19,代码来源:TaskCollectorFromImplicitTargetListener.java

示例7: isFailOnError

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
private static boolean isFailOnError(BuildEvent event) {
    final Task task = event.getTask();
    if (task != null) {
        try {
            final Field field = task.getClass().getDeclaredField("failonerror");
            field.setAccessible(true);
            return !Boolean.FALSE.equals(field.get(task));
        } catch (Exception ignored) {
        }
    }
    return true; // default value
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:13,代码来源:HybrisIdeaAntLogger.java

示例8: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent be) {
	if (be.getPriority() <= _logLevel) {
		String prefix = "";
		Task task = be.getTask();
		if (task != null) {
			String taskName = task.getTaskName();
			if (taskName != null) {
				prefix = padToLength(taskName) + " ";
			}
		}
		writeLog(prefix+be.getMessage());
	}
}
 
开发者ID:drftpd-ng,项目名称:drftpd3,代码行数:14,代码来源:PluginBuildListener.java

示例9: isFailOnError

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
private static boolean isFailOnError(BuildEvent event) {
  final Task task = event.getTask();
  if (task != null) {
    try {
      final Field field = task.getClass().getDeclaredField("failonerror");
      field.setAccessible(true);
      return !Boolean.FALSE.equals(field.get(task));
    }
    catch (Exception ignored) {
    }
  }
  return true; // default value
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:IdeaAntLogger2.java

示例10: taskStarted

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#taskStarted
 * {@inheritDoc}.
 */
@Override
public void taskStarted(final BuildEvent event) {
    final Task task = event.getTask();
    final Logger log = Logger.getLogger(task.getClass().getName());
    log.info("Task \"" + task.getTaskName() + "\" started.");
}
 
开发者ID:apache,项目名称:ant,代码行数:11,代码来源:Log4jListener.java

示例11: taskFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#taskFinished
 * {@inheritDoc}.
 */
@Override
public void taskFinished(final BuildEvent event) {
    final Task task = event.getTask();
    final Logger log = Logger.getLogger(task.getClass().getName());
    if (event.getException() == null) {
        log.info("Task \"" + task.getTaskName() + "\" finished.");
    } else {
        log.error("Task \"" + task.getTaskName()
            + "\" finished with error.", event.getException());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:Log4jListener.java

示例12: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#messageLogged
 * {@inheritDoc}.
 */
@Override
public void messageLogged(final BuildEvent event) {
    Object categoryObject = event.getTask();
    if (categoryObject == null) {
        categoryObject = event.getTarget();
        if (categoryObject == null) {
            categoryObject = event.getProject();
        }
    }

    final Logger log
        = Logger.getLogger(categoryObject.getClass().getName());
    switch (event.getPriority()) {
        case Project.MSG_ERR:
            log.error(event.getMessage());
            break;
        case Project.MSG_WARN:
            log.warn(event.getMessage());
            break;
        case Project.MSG_INFO:
            log.info(event.getMessage());
            break;
        case Project.MSG_VERBOSE:
            log.debug(event.getMessage());
            break;
        case Project.MSG_DEBUG:
            log.debug(event.getMessage());
            break;
        default:
            log.error(event.getMessage());
            break;
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:38,代码来源:Log4jListener.java

示例13: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#messageLogged
 * {@inheritDoc}.
 */
@Override
public void messageLogged(final BuildEvent event) {
    if (initialized) {
        Object categoryObject = event.getTask();
        String categoryString;
        String categoryDetail = null;

        if (categoryObject == null) {
            categoryObject = event.getTarget();
            if (categoryObject == null) {
                categoryString = PROJECT_LOG;
                categoryDetail = event.getProject().getName();
            } else {
                categoryString = TARGET_LOG;
                categoryDetail = event.getTarget().getName();
            }
        } else {
            // It's a task - append the target
            if (event.getTarget() != null) {
                categoryString = categoryObject.getClass().getName();
                categoryDetail = event.getTarget().getName();
            } else {
                categoryString = categoryObject.getClass().getName();
            }

        }

        final Log log = getLog(categoryString, categoryDetail);
        final int priority = event.getPriority();
        final String message = event.getMessage();
        realLog(log, message, priority, null);
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:38,代码来源:CommonsLoggingListener.java


注:本文中的org.apache.tools.ant.BuildEvent.getTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。