• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LifecycleExecutionException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.maven.lifecycle.LifecycleExecutionException的典型用法代码示例。如果您正苦于以下问题:Java LifecycleExecutionException类的具体用法?Java LifecycleExecutionException怎么用?Java LifecycleExecutionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LifecycleExecutionException类属于org.apache.maven.lifecycle包,在下文中一共展示了LifecycleExecutionException类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildExecutionPlanItem

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
private void buildExecutionPlanItem( ExecutionPlanItem current, PhaseRecorder phaseRecorder, Schedule schedule,
                                     ReactorContext reactorContext, ProjectSegment projectBuild,
                                     DependencyContext dependencyContext )
    throws LifecycleExecutionException
{
    if ( schedule != null && schedule.isMojoSynchronized() )
    {
        synchronized ( current.getPlugin() )
        {
            buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext, phaseRecorder );
        }
    }
    else
    {
        buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext, phaseRecorder );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:LifecycleWeaveBuilder.java


示例2: assertNotSrcdeps

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
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]));
    }
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:9,代码来源:SrcdepsEnforcer.java


示例3: getLifecycleForPhase

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的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


示例4: getPhaseToLifecycleMap

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的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


示例5: getLifecycleForPhase

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的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


示例6: getPhaseToLifecycleMap

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的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


示例7: execute

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
    throws LifecycleExecutionException

{
    DependencyContext dependencyContext = newDependencyContext( session, mojoExecutions );

    PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() );

    for ( MojoExecution mojoExecution : mojoExecutions )
    {
        execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:MojoExecutor.java


示例8: execute

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
@Override
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
                     DependencyContext dependencyContext, PhaseRecorder phaseRecorder )
    throws LifecycleExecutionException
{
    executions.add( mojoExecution );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:8,代码来源:MojoExecutorStub.java


示例9: afterProjectExecutionSuccess

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
@Override
public void afterProjectExecutionSuccess(ProjectExecutionEvent event) throws LifecycleExecutionException {
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:4,代码来源:SrcdepsEnforcer.java


示例10: beforeProjectExecution

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
@Override
public void beforeProjectExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:4,代码来源:SrcdepsEnforcer.java


示例11: beforeProjectLifecycleExecution

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
@Override
public void beforeProjectLifecycleExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
    final MavenProject project = event.getProject();
    log.info("srcdeps enforcer checks for violations in {}:{}", project.getGroupId(), project.getArtifactId());

    final Maven maven = configurationProducer.getConfiguration().getMaven();

    final List<MojoExecution> mojoExecutions = event.getExecutionPlan();
    final List<String> goals = new ArrayList<>(mojoExecutions.size());
    for (MojoExecution mojoExecution : mojoExecutions) {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
        goals.add(mojoDescriptor.getFullGoalName());
        goals.add(mojoDescriptor.getGoal());
    }

    final List<String> profiles = new ArrayList<>();
    final List<Profile> activeProfiles = project.getActiveProfiles();
    for (Profile profile : activeProfiles) {
        final String id = profile.getId();
        profiles.add(id);
    }

    final Properties props = new Properties();
    props.putAll(project.getProperties());
    props.putAll(System.getProperties());

    String[] firstViolation = assertFailWithout(maven.getFailWithout(), goals, profiles, props);
    if (firstViolation == null) {
        firstViolation = assertFailWith(maven.getFailWith(), goals, profiles, props);
    }
    if (firstViolation != null) {
        /* check if there are srcdeps */
        Artifact parent = project.getParentArtifact();
        if (parent != null) {
            assertNotSrcdeps(parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), firstViolation);
        }
        DependencyManagement dm;
        List<Dependency> deps;
        if ((dm = project.getDependencyManagement()) != null && (deps = dm.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
        if ((deps = project.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
    }
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:47,代码来源:SrcdepsEnforcer.java


示例12: execute

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
private int execute( CliRequest cliRequest )
{
    eventSpyDispatcher.onEvent( cliRequest.request );

    MavenExecutionResult result = maven.execute( cliRequest.request );

    eventSpyDispatcher.onEvent( result );

    eventSpyDispatcher.close();

    if ( result.hasExceptions() )
    {
        ExceptionHandler handler = new DefaultExceptionHandler();

        Map<String, String> references = new LinkedHashMap<String, String>();

        MavenProject project = null;

        for ( Throwable exception : result.getExceptions() )
        {
            ExceptionSummary summary = handler.handleException( exception );

            logSummary( summary, references, "", cliRequest.showErrors );

            if ( project == null && exception instanceof LifecycleExecutionException )
            {
                project = ( (LifecycleExecutionException) exception ).getProject();
            }
        }

        slf4jLogger.error( "" );

        if ( !cliRequest.showErrors )
        {
            slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the -e switch." );
        }
        if ( !slf4jLogger.isDebugEnabled() )
        {
            slf4jLogger.error( "Re-run Maven using the -X switch to enable full debug logging." );
        }

        if ( !references.isEmpty() )
        {
            slf4jLogger.error( "" );
            slf4jLogger.error( "For more information about the errors and possible solutions"
                          + ", please read the following articles:" );

            for ( Map.Entry<String, String> entry : references.entrySet() )
            {
                slf4jLogger.error( entry.getValue() + " " + entry.getKey() );
            }
        }

        if ( project != null && !project.equals( result.getTopologicallySortedProjects().get( 0 ) ) )
        {
            slf4jLogger.error( "" );
            slf4jLogger.error( "After correcting the problems, you can resume the build with the command" );
            slf4jLogger.error( "  mvn <goals> -rf :" + project.getArtifactId() );
        }

        if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( cliRequest.request.getReactorFailureBehavior() ) )
        {
            slf4jLogger.info( "Build failures were ignored." );

            return 0;
        }
        else
        {
            return 1;
        }
    }
    else
    {
        return 0;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:77,代码来源:MavenCli.java


示例13: getDependencies

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
private Set<Artifact> getDependencies( MavenProject project, Collection<String> scopesToCollect,
                                       Collection<String> scopesToResolve, MavenSession session,
                                       boolean aggregating, Set<Artifact> projectArtifacts )
    throws LifecycleExecutionException
{
    if ( scopesToCollect == null )
    {
        scopesToCollect = Collections.emptySet();
    }
    if ( scopesToResolve == null )
    {
        scopesToResolve = Collections.emptySet();
    }

    if ( scopesToCollect.isEmpty() && scopesToResolve.isEmpty() )
    {
        return new LinkedHashSet<Artifact>();
    }

    scopesToCollect = new HashSet<String>( scopesToCollect );
    scopesToCollect.addAll( scopesToResolve );

    DependencyFilter collectionFilter = new ScopeDependencyFilter( null, negate( scopesToCollect ) );
    DependencyFilter resolutionFilter = new ScopeDependencyFilter( null, negate( scopesToResolve ) );
    resolutionFilter = AndDependencyFilter.newInstance( collectionFilter, resolutionFilter );
    resolutionFilter =
        AndDependencyFilter.newInstance( resolutionFilter, new ReactorDependencyFilter( projectArtifacts ) );

    DependencyResolutionResult result;
    try
    {
        DefaultDependencyResolutionRequest request =
            new DefaultDependencyResolutionRequest( project, session.getRepositorySession() );
        request.setResolutionFilter( resolutionFilter );

        eventSpyDispatcher.onEvent( request );

        result = dependenciesResolver.resolve( request );
    }
    catch ( DependencyResolutionException e )
    {
        result = e.getResult();

        /*
         * MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator
         * plugins that require dependency resolution although they usually run in phases of the build where project
         * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare".
         */
        if ( aggregating && areAllDependenciesInReactor( session.getProjects(), result.getUnresolvedDependencies() ) )
        {
            logger.warn( "The following dependencies could not be resolved at this point of the build"
                + " but seem to be part of the reactor:" );

            for ( Dependency dependency : result.getUnresolvedDependencies() )
            {
                logger.warn( "o " + dependency );
            }

            logger.warn( "Try running the build up to the lifecycle phase \"package\"" );
        }
        else
        {
            throw new LifecycleExecutionException( null, project, e );
        }
    }

    eventSpyDispatcher.onEvent( result );

    Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
    if ( result.getDependencyGraph() != null && !result.getDependencyGraph().getChildren().isEmpty() )
    {
        RepositoryUtils.toArtifacts( artifacts, result.getDependencyGraph().getChildren(),
                                     Collections.singletonList( project.getArtifact().getId() ), collectionFilter );
    }
    return artifacts;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:77,代码来源:LifecycleDependencyResolver.java


示例14: resolveBuildPlan

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment,
                                            Set<Artifact> projectArtifacts )
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException,
    LifecycleExecutionException
{
    MavenExecutionPlan executionPlan =
        lifeCycleExecutionPlanCalculator.calculateExecutionPlan( session, project, taskSegment.getTasks() );

    lifecycleDebugLogger.debugProjectPlan( project, executionPlan );

    if ( session.getRequest().isThreadConfigurationPresent() )
    {
        final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins();
        if ( !unsafePlugins.isEmpty() )
        {
            logger.warn( "*****************************************************************" );
            logger.warn( "* Your build is requesting parallel execution, but project      *" );
            logger.warn( "* contains the following plugin(s) that have goals not marked   *" );
            logger.warn( "* as @threadSafe to support parallel building.                  *" );
            logger.warn( "* While this /may/ work fine, please look for plugin updates    *" );
            logger.warn( "* and/or request plugins be made thread-safe.                   *" );
            logger.warn( "* If reporting an issue, report it against the plugin in        *" );
            logger.warn( "* question, not against maven-core                              *" );
            logger.warn( "*****************************************************************" );
            if ( logger.isDebugEnabled() )
            {
                final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos();
                logger.warn( "The following goals are not marked @threadSafe in " + project.getName() + ":" );
                for ( MojoDescriptor unsafeGoal : unsafeGoals )
                {
                    logger.warn( unsafeGoal.getId() );
                }
            }
            else
            {
                logger.warn( "The following plugins are not marked @threadSafe in " + project.getName() + ":" );
                for ( Plugin unsafePlugin : unsafePlugins )
                {
                    logger.warn( unsafePlugin.getId() );
                }
                logger.warn( "Enable debug to see more precisely which goals are not marked @threadSafe." );
            }
            logger.warn( "*****************************************************************" );
        }
    }

    return executionPlan;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:51,代码来源:BuilderCommon.java


示例15: getReference

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
private String getReference( Throwable exception )
{
    String reference = "";

    if ( exception != null )
    {
        if ( exception instanceof MojoExecutionException )
        {
            reference = MojoExecutionException.class.getSimpleName();

            Throwable cause = exception.getCause();
            if ( cause instanceof IOException )
            {
                cause = cause.getCause();
                if ( cause instanceof ConnectException )
                {
                    reference = ConnectException.class.getSimpleName();
                }
            }
        }
        else if ( exception instanceof MojoFailureException )
        {
            reference = MojoFailureException.class.getSimpleName();
        }
        else if ( exception instanceof LinkageError )
        {
            reference = LinkageError.class.getSimpleName();
        }
        else if ( exception instanceof PluginExecutionException )
        {
            reference = getReference( exception.getCause() );

            if ( StringUtils.isEmpty( reference ) )
            {
                reference = exception.getClass().getSimpleName();
            }
        }
        else if ( exception instanceof LifecycleExecutionException )
        {
            reference = getReference( exception.getCause() );
        }
        else if ( isNoteworthyException( exception ) )
        {
            reference = exception.getClass().getSimpleName();
        }
    }

    if ( StringUtils.isNotEmpty( reference ) && !reference.startsWith( "http:" ) )
    {
        reference = "http://cwiki.apache.org/confluence/display/MAVEN/" + reference;
    }

    return reference;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:55,代码来源:DefaultExceptionHandler.java


示例16: execute

import org.apache.maven.lifecycle.LifecycleExecutionException; //导入依赖的package包/类
protected int execute(AFCliRequest cliRequest) throws MavenExecutionRequestPopulationException {
    MavenExecutionRequest request = executionRequestPopulator.populateDefaults(cliRequest.getRequest());

    eventSpyDispatcher.onEvent(request);

    MavenExecutionResult result = maven.execute(request);

    eventSpyDispatcher.onEvent(result);

    eventSpyDispatcher.close();

    if (result.hasExceptions()) {
        ExceptionHandler handler = new DefaultExceptionHandler();

        Map<String, String> references = new LinkedHashMap<String, String>();

        MavenProject project = null;

        for (Throwable exception : result.getExceptions()) {
            ExceptionSummary summary = handler.handleException(exception);

            logSummary(summary,
                       references,
                       "",
                       cliRequest.isShowErrors());

            if (project == null && exception instanceof LifecycleExecutionException) {
                project = ((LifecycleExecutionException) exception).getProject();
            }
        }

        slf4jLogger.error("");

        if (!cliRequest.isShowErrors()) {
            slf4jLogger.error("To see the full stack trace of the errors, re-run Maven with the -e switch.");
        }
        if (!slf4jLogger.isDebugEnabled()) {
            slf4jLogger.error("Re-run Maven using the -X switch to enable full debug logging.");
        }

        if (!references.isEmpty()) {
            slf4jLogger.error("");
            slf4jLogger.error("For more information about the errors and possible solutions"
                                      + ", please read the following articles:");

            for (Entry<String, String> entry : references.entrySet()) {
                slf4jLogger.error(entry.getValue() + " " + entry.getKey());
            }
        }

        if (project != null && !project.equals(result.getTopologicallySortedProjects().get(0))) {
            slf4jLogger.error("");
            slf4jLogger.error("After correcting the problems, you can resume the build with the command");
            slf4jLogger.error("  mvn <goals> -rf :" + project.getArtifactId());
        }

        if (MavenExecutionRequest.REACTOR_FAIL_NEVER.equals(cliRequest.getRequest().getReactorFailureBehavior())) {
            slf4jLogger.info("Build failures were ignored.");
            return 0;
        } else {
            return 1;
        }
    } else {
        return 0;
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:67,代码来源:AFMavenCli.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DicomObject类代码示例发布时间:2022-05-22
下一篇:
Java SRVRecord类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap