Package org.codehaus.plexus.taskqueue.execution

Examples of org.codehaus.plexus.taskqueue.execution.TaskExecutionException


                        projectDao.updateProject( project );
                    }
                }
                catch ( ContinuumStoreException e )
                {
                    throw new TaskExecutionException( "Error storing the project", e );
                }
            }
        }
        finally
        {
View Full Code Here


                context.setBuildResult( build );
            }
            catch ( ContinuumStoreException e )
            {
                throw new TaskExecutionException( "Error updating build result", e );
            }
        }

        context.getProject().setState( build.getState() );

        try
        {
            projectDao.updateProject( context.getProject() );
        }
        catch ( ContinuumStoreException e )
        {
            throw new TaskExecutionException( "Error updating project", e );
        }
    }
View Full Code Here

        {
            projectDao.updateProject( project );
        }
        catch ( ContinuumStoreException e )
        {
            throw new TaskExecutionException( "Error persisting project", e );
        }

        notifierDispatcher.buildStarted( project, context.getBuildDefinition() );

    }
View Full Code Here

            //        getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() ) );
            //}
        }
        catch ( ContinuumStoreException e )
        {
            throw new TaskExecutionException( "Error initializing the build context", e );
        }

        Map<String, Object> actionContext = context.getActionContext();

        AbstractContinuumAction.setProjectId( actionContext, projectId );
View Full Code Here

    private void performAction( String actionName, BuildContext context )
        throws TaskExecutionException
    {
        String error;
        TaskExecutionException exception;

        try
        {
            log.info( "Performing action " + actionName );
            actionManager.lookup( actionName ).execute( context.getActionContext() );
            return;
        }
        catch ( ActionNotFoundException e )
        {
            error = ContinuumUtils.throwableToString( e );
            exception = new TaskExecutionException( "Error looking up action '" + actionName + "'", e );
        }
        catch ( ScmRepositoryException e )
        {
            error = getValidationMessages( e ) + "\n" + ContinuumUtils.throwableToString( e );

            exception = new TaskExecutionException( "SCM error while executing '" + actionName + "'", e );
        }
        catch ( ScmException e )
        {
            error = ContinuumUtils.throwableToString( e );

            exception = new TaskExecutionException( "SCM error while executing '" + actionName + "'", e );
        }
        catch ( Exception e )
        {
            exception = new TaskExecutionException( "Error executing action '" + actionName + "'", e );
            error = ContinuumUtils.throwableToString( exception );
        }

        // TODO: clean this up. We catch the original exception from the action, and then update the buildresult
        // for it - we need to because of the specialized error message for SCM.
View Full Code Here

                }
            }
            catch ( Exception e )
            {
                updateBuildResult( context, ContinuumUtils.throwableToString( e ) );
                throw new TaskExecutionException( "Can't determine if the project should build or not", e );
            }
        }

        if ( shouldBuild )
        {
            log.info( "Changes found in the current project, building" );
        }
        else
        {
            project.setState( project.getOldState() );

            project.setOldState( 0 );

            try
            {
                projectDao.updateProject( project );
            }
            catch ( ContinuumStoreException e )
            {
                throw new TaskExecutionException( "Error storing project", e );
            }
            log.info( "No changes in the current project, not building" );

        }
View Full Code Here

            return build;
        }
        catch ( ContinuumStoreException e )
        {
            throw new TaskExecutionException( "Error storing build result", e );
        }
    }
View Full Code Here

            continuumReleaseManager.getReleaseResults().put( releaseTask.getReleaseId(), result );

            releaseTask.getListener().error( e.getMessage() );

            throw new TaskExecutionException( "Failed to build reactor projects.", e );
        }

        return reactorProjects;
    }
View Full Code Here

                                     releaseTask.getListener() );
        }
        catch ( ReleaseExecutionException e )
        {
            updateListener( releaseTask.getListener(), e.getMessage() );
            throw new TaskExecutionException( "Failed to rollback release", e );
        }
        catch ( ReleaseFailureException e )
        {
            updateListener( releaseTask.getListener(), e.getMessage() );
            throw new TaskExecutionException( "Failed to rollback release", e );
        }
    }
View Full Code Here

            {
                nexusIndexer.scan( context, null, indexingTask.isOnlyUpdate() );
            }
            catch ( IOException e )
            {
                throw new TaskExecutionException( "Error scan repository " + repository, e );
            }
            log.debug( "Finishing indexing task on repo: {}", repository.getId() );
            finishIndexingTask( indexingTask, repository, context );
        }
        else
        {
            // create context if not a repo scan request
            if ( !indexingTask.isExecuteOnEntireRepo() )
            {
                try
                {
                    log.debug( "Creating indexing context on resource: {}", indexingTask.getResourceFile().getPath() );
                    context = managedRepositoryAdmin.createIndexContext( repository );
                }
                catch ( RepositoryAdminException e )
                {
                    log.error( "Error occurred while creating context: " + e.getMessage() );
                    throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage(), e );
                }
            }

            if ( context == null || context.getIndexDirectory() == null )
            {
                throw new TaskExecutionException( "Trying to index an artifact but the context is already closed" );
            }

            try
            {
                File artifactFile = indexingTask.getResourceFile();
                ArtifactContext ac = artifactContextProducer.getArtifactContext( context, artifactFile );

                if ( ac != null )
                {
                    if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
                    {
                        //IndexSearcher s = context.getIndexSearcher();
                        //String uinfo = ac.getArtifactInfo().getUinfo();
                        //TopDocs d = s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), 1 );

                        BooleanQuery q = new BooleanQuery();
                        q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression(
                            ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST );
                        q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression(
                            ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST );
                        q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression(
                            ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST );
                        if ( ac.getArtifactInfo().classifier != null )
                        {
                            q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression(
                                ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST );
                        }
                        if ( ac.getArtifactInfo().packaging != null )
                        {
                            q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
                                ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
                        }
                        FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
                        FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
                        if ( flatSearchResponse.getResults().isEmpty() )
                        {
                            log.debug( "Adding artifact '{}' to index..", ac.getArtifactInfo() );
                            nexusIndexer.addArtifactToIndex( ac, context );
                        }
                        else
                        {
                            log.debug( "Updating artifact '{}' in index..", ac.getArtifactInfo() );
                            // TODO check if update exists !!
                            nexusIndexer.deleteArtifactFromIndex( ac, context );
                            nexusIndexer.addArtifactToIndex( ac, context );
                        }

                        context.updateTimestamp();

                        // close the context if not a repo scan request
                        if ( !indexingTask.isExecuteOnEntireRepo() )
                        {
                            log.debug( "Finishing indexing task on resource file : {}",
                                       indexingTask.getResourceFile().getPath() );
                            finishIndexingTask( indexingTask, repository, context );
                        }
                    }
                    else
                    {
                        log.debug( "Removing artifact '{}' from index..", ac.getArtifactInfo() );
                        nexusIndexer.deleteArtifactFromIndex( ac, context );
                    }
                }
            }
            catch ( IOException e )
            {
                log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage(),
                           e );
                throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask + "'",
                                                  e );
            }
            catch ( IllegalArtifactCoordinateException e )
            {
                log.error( "Error occurred while getting artifact context: " + e.getMessage() );
                throw new TaskExecutionException( "Error occurred while getting artifact context.", e );
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.taskqueue.execution.TaskExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.