當前位置: 首頁>>代碼示例>>Java>>正文


Java Lifecycle類代碼示例

本文整理匯總了Java中org.apache.maven.lifecycle.Lifecycle的典型用法代碼示例。如果您正苦於以下問題:Java Lifecycle類的具體用法?Java Lifecycle怎麽用?Java Lifecycle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Lifecycle類屬於org.apache.maven.lifecycle包,在下文中一共展示了Lifecycle類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOrderedLifecycles

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
private List<Lifecycle> getOrderedLifecycles()
{
    // NOTE: The lifecycle order can affect implied execution ids so we better be deterministic.

    List<Lifecycle> lifecycles = new ArrayList<Lifecycle>( defaultLifeCycles.getLifeCycles() );

    Collections.sort( lifecycles, new Comparator<Lifecycle>()
    {

        public int compare( Lifecycle l1, Lifecycle l2 )
        {
            return l1.getId().compareTo( l2.getId() );
        }

    } );

    return lifecycles;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:19,代碼來源:DefaultLifecyclePluginAnalyzer.java

示例2: getLifecycleForPhase

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
/**
 * Gets the lifecycle for phase.
 *
 * @param lifecycles The list of lifecycles.
 * @param phase the phase
 * @return the lifecycle for phase
 * @throws BuildFailureException the build failure exception
 * @throws LifecycleExecutionException the lifecycle execution exception
 */
private Lifecycle getLifecycleForPhase( List lifecycles, String phase )
    throws BuildFailureException, LifecycleExecutionException
{
    Lifecycle lifecycle = (Lifecycle) getPhaseToLifecycleMap( lifecycles ).get( phase );

    if ( lifecycle == null )
    {
        throw new BuildFailureException( "Unable to find lifecycle for phase '" + phase + "'" );
    }
    return lifecycle;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:21,代碼來源:DisplayPluginUpdatesMojo.java

示例3: getPhaseToLifecycleMap

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
/**
 * Gets the phase to lifecycle map.
 *
 * @param lifecycles The list of lifecycles.
 * @return the phase to lifecycle map.
 * @throws LifecycleExecutionException the lifecycle execution exception.
 */
public Map getPhaseToLifecycleMap( List<Lifecycle> lifecycles )
    throws LifecycleExecutionException
{
    Map<String, Lifecycle> phaseToLifecycleMap = new HashMap();

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

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

            if ( phaseToLifecycleMap.containsKey( phase ) )
            {
                Lifecycle prevLifecycle = 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;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:36,代碼來源:DisplayPluginUpdatesMojo.java

示例4: getLifecycleForPhase

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
/**
 * Gets the lifecycle for phase.
 *
 * @param lifecycles The list of lifecycles.
 * @param phase      the phase
 * @return the lifecycle for phase
 * @throws BuildFailureException       the build failure exception
 * @throws LifecycleExecutionException the lifecycle execution exception
 */
private Lifecycle getLifecycleForPhase( List lifecycles, String phase )
    throws BuildFailureException, LifecycleExecutionException
{
    Lifecycle lifecycle = (Lifecycle) getPhaseToLifecycleMap( lifecycles ).get( phase );

    if ( lifecycle == null )
    {
        throw new BuildFailureException( "Unable to find lifecycle for phase '" + phase + "'" );
    }
    return lifecycle;
}
 
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:21,代碼來源:DisplayPluginUpdatesMojo.java

示例5: getPhaseToLifecycleMap

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
/**
 * Gets the phase to lifecycle map.
 *
 * @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;
}
 
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:36,代碼來源:DisplayPluginUpdatesMojo.java

示例6: createDefaultLifecycles

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
public static DefaultLifecycles createDefaultLifecycles()
{

    List<String> stubDefaultCycle =
        Arrays.asList( VALIDATE.getPhase(), INITIALIZE.getPhase(), PROCESS_RESOURCES.getPhase(), COMPILE.getPhase(),
                       TEST.getPhase(), PROCESS_TEST_RESOURCES.getPhase(), PACKAGE.getPhase(), "BEER",
                       INSTALL.getPhase() );

    // The two phases below are really for future expansion, some would say they lack a drink
    // The point being that they do not really have to match the "real" stuff,
    List<String> stubCleanCycle = Arrays.asList( PRE_CLEAN.getPhase(), CLEAN.getPhase(), POST_CLEAN.getPhase() );

    List<String> stubSiteCycle =
        Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() );

    @SuppressWarnings( "unchecked" )
    Iterator<List<String>> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator();

    Map<String, Lifecycle> lifeCycles = new HashMap<String, Lifecycle>();
    for ( String s : DefaultLifecycles.STANDARD_LIFECYCLES )
    {
        final Lifecycle lifecycle = new Lifecycle( s, lcs.next(), null );
        lifeCycles.put( s, lifecycle );

    }
    return new DefaultLifecycles( lifeCycles, new LoggerStub() );
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:28,代碼來源:DefaultLifecyclesStub.java

示例7: getPluginsBoundByDefaultToAllLifecycles

import org.apache.maven.lifecycle.Lifecycle; //導入依賴的package包/類
public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
{
    if ( logger.isDebugEnabled() )
    {
        logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from " +
            Thread.currentThread().getContextClassLoader() );
    }

    LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );

    if ( lifecycleMappingForPackaging == null )
    {
        return null;
    }

    Map<Plugin, Plugin> plugins = new LinkedHashMap<Plugin, Plugin>();

    for ( Lifecycle lifecycle : getOrderedLifecycles() )
    {
        org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration =
            lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );

        Map<String, String> phaseToGoalMapping = null;

        if ( lifecycleConfiguration != null )
        {
            phaseToGoalMapping = lifecycleConfiguration.getPhases();
        }
        else if ( lifecycle.getDefaultPhases() != null )
        {
            phaseToGoalMapping = lifecycle.getDefaultPhases();
        }

        if ( phaseToGoalMapping != null )
        {
            // These are of the form:
            //
            // compile -> org.apache.maven.plugins:maven-compiler-plugin:compile[,gid:aid:goal,...]
            //
            for ( Map.Entry<String, String> goalsForLifecyclePhase : phaseToGoalMapping.entrySet() )
            {
                String phase = goalsForLifecyclePhase.getKey();
                String goals = goalsForLifecyclePhase.getValue();
                if ( goals != null )
                {
                    parseLifecyclePhaseDefinitions( plugins, phase, goals );
                }
            }
        }
    }

    return plugins.keySet();
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:54,代碼來源:DefaultLifecyclePluginAnalyzer.java


注:本文中的org.apache.maven.lifecycle.Lifecycle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。