Example usage for org.apache.maven.plugin.descriptor MojoDescriptor getPhase

List of usage examples for org.apache.maven.plugin.descriptor MojoDescriptor getPhase

Introduction

In this page you can find the example usage for org.apache.maven.plugin.descriptor MojoDescriptor getPhase.

Prototype

public String getPhase() 

Source Link

Usage

From source file:fr.jcgay.maven.plugin.buildplan.display.AbstractTableDescriptor.java

License:Apache License

protected static Map<TableColumn, Integer> findMaxSize(Collection<MojoExecution> executions,
        TableColumn... columns) {

    Map<TableColumn, Integer> result = new HashMap<TableColumn, Integer>();

    Multimap<TableColumn, Integer> count = ArrayListMultimap.create();
    for (MojoExecution execution : executions) {
        for (TableColumn column : columns) {
            switch (column) {
            case ARTIFACT_ID:
                count.put(column, safeLength(execution.getArtifactId()));
                break;
            case EXECUTION_ID:
                count.put(column, safeLength(execution.getExecutionId()));
                break;
            case GOAL:
                count.put(column, safeLength(execution.getGoal()));
                break;
            case PHASE:
                MojoDescriptor mojoDescriptor = execution.getMojoDescriptor();
                if (mojoDescriptor != null && mojoDescriptor.getPhase() != null) {
                    count.put(column, safeLength(mojoDescriptor.getPhase()));
                } else {
                    count.put(column, safeLength(execution.getLifecyclePhase()));
                }//from   www  .  ja  v a  2s.  co  m
            }
        }
    }
    for (TableColumn column : TableColumn.values()) {
        count.put(column, column.title().length());
    }

    for (TableColumn key : count.keySet()) {
        result.put(key, Collections.max(count.get(key)));
    }

    return result;
}