Example usage for org.apache.maven.lifecycle LifecycleExecutionException LifecycleExecutionException

List of usage examples for org.apache.maven.lifecycle LifecycleExecutionException LifecycleExecutionException

Introduction

In this page you can find the example usage for org.apache.maven.lifecycle LifecycleExecutionException LifecycleExecutionException.

Prototype

public LifecycleExecutionException(Throwable cause) 

Source Link

Usage

From source file:org.codehaus.mojo.versions.DisplayPluginUpdatesMojo.java

License:Apache License

/**
 * Gets the phase to lifecycle map./*from w  w w .  j a  v a 2 s.c o  m*/
 *
 * @param lifecycles The list of lifecycles.
 * @return the phase to lifecycle map.
 * @throws LifecycleExecutionException the lifecycle execution exception.
 */
public Map getPhaseToLifecycleMap(List lifecycles) throws LifecycleExecutionException {
    Map phaseToLifecycleMap = new HashMap();

    for (Iterator i = lifecycles.iterator(); i.hasNext();) {
        Lifecycle lifecycle = (Lifecycle) i.next();

        for (Iterator p = lifecycle.getPhases().iterator(); p.hasNext();) {
            String phase = (String) p.next();

            if (phaseToLifecycleMap.containsKey(phase)) {
                Lifecycle prevLifecycle = (Lifecycle) phaseToLifecycleMap.get(phase);
                throw new LifecycleExecutionException(
                        "Phase '" + phase + "' is defined in more than one lifecycle: '" + lifecycle.getId()
                                + "' and '" + prevLifecycle.getId() + "'");
            } else {
                phaseToLifecycleMap.put(phase, lifecycle);
            }
        }
    }
    return phaseToLifecycleMap;
}

From source file:org.srcdeps.mvn.enforcer.SrcdepsEnforcer.java

License:Apache License

private static void assertNotSrcdeps(String group, String artifact, String version, String[] violation)
        throws LifecycleExecutionException {
    if (SrcVersion.isSrcVersion(version)) {
        throw new LifecycleExecutionException(String.format(
                "This build was configured to fail if there is a source dependency [%s:%s:%s] and %s [%s]",
                group, artifact, version, violation[0], violation[1]));
    }/*  ww  w  .  j  a  va2s.  co  m*/
}