当前位置: 首页>>代码示例>>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;未经允许,请勿转载。