Java 类org.apache.maven.plugin.PluginResolutionException 实例源码

项目:incubator-netbeans    文件:NbPluginDependenciesResolver.java   
@Override
public Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session) throws PluginResolutionException {
    WorkspaceReader wr = session.getWorkspaceReader();
    NbWorkspaceReader nbwr = null;
    if (wr instanceof NbWorkspaceReader) {
        nbwr = (NbWorkspaceReader)wr;
        //this only works reliably because the NbWorkspaceReader is part of the session, not a component
        nbwr.silence();
    }
    try {
        return super.resolve(plugin, repositories, session);
    } finally {
        if (nbwr != null) {
            nbwr.normal();
        }
    }
}
项目:incubator-netbeans    文件:NbPluginDependenciesResolver.java   
@Override
public DependencyNode resolve(Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter, List<RemoteRepository> repositories, RepositorySystemSession session) throws PluginResolutionException {

    WorkspaceReader wr = session.getWorkspaceReader();
    NbWorkspaceReader nbwr = null;
    if (wr instanceof NbWorkspaceReader) {
        nbwr = (NbWorkspaceReader)wr;
        //this only works reliably because the NbWorkspaceReader is part of the session, not a component
        nbwr.silence();
    }
    try {
        return super.resolve(plugin, pluginArtifact, dependencyFilter, repositories, session);
    } finally {
        if (nbwr != null) {
            nbwr.normal();
        }
    }
}
项目:FitNesseLauncher    文件:SetupsMojoTestHelper.java   
@SuppressWarnings( "unchecked" )
void setupArtifact( String groupId, String artifactId, String goal, String type )
      throws DuplicateMojoDescriptorException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {

   DefaultArtifact artifact = new DefaultArtifact( groupId, artifactId, "DUMMY", "compile", type, "", null );
   MojoDescriptor mojoDescriptor = new MojoDescriptor();
   mojoDescriptor.setGoal( goal );
   PluginDescriptor pluginDescriptor = new PluginDescriptor();
   pluginDescriptor.addMojo( mojoDescriptor );

   Plugin plugin = new Plugin();
   plugin.setGroupId( groupId );
   plugin.setArtifactId( artifactId );

   when( this.mojo.pluginManager.loadPlugin( eq( plugin ), anyList(), any( RepositorySystemSession.class ) ) ).thenReturn( pluginDescriptor );

   this.mojo.pluginDescriptor.getArtifactMap().put( String.format( "%s:%s", groupId, artifactId ), artifact );
}
项目:FitNesseLauncher    文件:SetupsMojoTestHelper.java   
@SuppressWarnings( "unchecked" )
void setupArtifact( String groupId, String artifactId, String goal, String type )
      throws DuplicateMojoDescriptorException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {

   DefaultArtifact artifact = new DefaultArtifact( groupId, artifactId, "DUMMY", "compile", type, "", null );
   MojoDescriptor mojoDescriptor = new MojoDescriptor();
   mojoDescriptor.setGoal( goal );
   PluginDescriptor pluginDescriptor = new PluginDescriptor();
   pluginDescriptor.addMojo( mojoDescriptor );

   Plugin plugin = new Plugin();
   plugin.setGroupId( groupId );
   plugin.setArtifactId( artifactId );

   when( this.mojo.pluginManager.loadPlugin( eq( plugin ), anyList(), any( RepositorySystemSession.class ) ) ).thenReturn( pluginDescriptor );

   this.mojo.pluginDescriptor.getArtifactMap().put( String.format( "%s:%s", groupId, artifactId ), artifact );
}
项目:iterator-maven-plugin    文件:IteratorMojo.java   
/**
 * Taken from MojoExecutor of Don Brown. Make it working with Maven 3.1.
 * 
 * @param plugin
 * @param goal
 * @param configuration
 * @param env
 * @throws MojoExecutionException
 * @throws PluginResolutionException
 * @throws PluginDescriptorParsingException
 * @throws InvalidPluginDescriptorException
 * @throws PluginManagerException
 * @throws PluginConfigurationException
 * @throws MojoFailureException
 */
private void executeMojo( Plugin plugin, String goal, Xpp3Dom configuration )
    throws MojoExecutionException, PluginResolutionException, PluginDescriptorParsingException,
    InvalidPluginDescriptorException, MojoFailureException, PluginConfigurationException, PluginManagerException
{

    if ( configuration == null )
    {
        throw new NullPointerException( "configuration may not be null" );
    }

    PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin );

    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
    if ( mojoDescriptor == null )
    {
        throw new MojoExecutionException( "Could not find goal '" + goal + "' in plugin " + plugin.getGroupId()
            + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() );
    }

    MojoExecution exec = mojoExecution( mojoDescriptor, configuration );
    pluginManager.executeMojo( getMavenSession(), exec );
}
项目:oceano    文件:DefaultLifecycleTaskSegmentCalculator.java   
public List<TaskSegment> calculateTaskSegments( MavenSession session )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException
{

    MavenProject rootProject = session.getTopLevelProject();

    List<String> tasks = session.getGoals();

    if ( tasks == null || tasks.isEmpty() )
    {
        if ( !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
        {
            tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
        }
    }

    return calculateTaskSegments( session, tasks );
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks, boolean setup )
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    lifecyclePluginResolver.resolveMissingPluginVersions( project, session );

    final List<MojoExecution> executions = calculateMojoExecutions( session, project, tasks );

    if ( setup )
    {
        setupMojoExecutions( session, project, executions );
    }

    final List<ExecutionPlanItem> planItem = defaultSchedules.createExecutionPlanItem( project, executions );

    return new MavenExecutionPlan( planItem, defaultLifeCycles );
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

    if ( mojoDescriptor == null )
    {
        mojoDescriptor =
            pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
                                             project.getRemotePluginRepositories(),
                                             session.getRepositorySession() );

        mojoExecution.setMojoDescriptor( mojoDescriptor );
    }

    populateMojoExecutionConfiguration( project, mojoExecution,
                                        MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );

    finalizeMojoConfiguration( mojoExecution );

    calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
}
项目:oceano    文件:DefaultLifecycleExecutor.java   
@SuppressWarnings( { "UnusedDeclaration" } )
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
    PluginVersionResolutionException
{
    List<TaskSegment> taskSegments =
        lifecycleTaskSegmentCalculator.calculateTaskSegments( session, Arrays.asList( tasks ) );

    TaskSegment mergedSegment = new TaskSegment( false );

    for ( TaskSegment taskSegment : taskSegments )
    {
        mergedSegment.getTasks().addAll( taskSegment.getTasks() );
    }

    return lifecycleExecutionPlanCalculator.calculateExecutionPlan( session, session.getCurrentProject(),
                                                                    mergedSegment.getTasks(), setup );
}
项目:oceano    文件:DefaultMavenPluginManager.java   
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
                                         RepositorySystemSession session )
    throws MojoNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    InvalidPluginDescriptorException
{
    PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin, repositories, session );

    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );

    if ( mojoDescriptor == null )
    {
        throw new MojoNotFoundException( goal, pluginDescriptor );
    }

    return mojoDescriptor;
}
项目:oceano    文件:DefaultPluginManager.java   
public PluginDescriptor loadPluginFully( Plugin plugin, MavenProject project, MavenSession session )
    throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
    InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
    PluginVersionNotFoundException
{
    PluginDescriptor pluginDescriptor = loadPluginDescriptor( plugin, project, session );

    try
    {
        pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
    }
    catch ( PluginResolutionException e )
    {
        throw new PluginManagerException( plugin, e.getMessage(), e );
    }

    return pluginDescriptor;
}
项目:oceano    文件:ConcurrencyDependencyGraphTest.java   
public void testConcurrencyGraphDifferentCompletionOrder()
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    ProjectDependencyGraph dependencyGraph = new ProjectDependencyGraphStub();
    final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
    ConcurrencyDependencyGraph graph =
        new ConcurrencyDependencyGraph( getProjectBuildList( session ), dependencyGraph );

    graph.markAsFinished( A );
    final List<MavenProject> cDescendants = graph.markAsFinished( C );
    assertEquals( 1, cDescendants.size() );
    assertEquals( Z, cDescendants.get( 0 ) );

    final List<MavenProject> bDescendants = graph.markAsFinished( B );
    assertEquals( 2, bDescendants.size() );
    assertEquals( X, bDescendants.get( 0 ) );
    assertEquals( Y, bDescendants.get( 1 ) );
}
项目:oceano    文件:ProjectDependencyGraphStub.java   
public static List<ProjectSegment> getProjectBuilds( MavenSession session )
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, PluginNotFoundException, MojoNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    List<ProjectSegment> projectBuilds = new ArrayList<ProjectSegment>();

    TaskSegment segment = createTaskSegment();
    projectBuilds.add( createProjectBuild( A, session, segment ) );
    projectBuilds.add( createProjectBuild( B, session, segment ) );
    projectBuilds.add( createProjectBuild( C, session, segment ) );
    projectBuilds.add( createProjectBuild( X, session, segment ) );
    projectBuilds.add( createProjectBuild( Y, session, segment ) );
    projectBuilds.add( createProjectBuild( Z, session, segment ) );
    return projectBuilds;
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks,
                                                  boolean setup )
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    if ( project.equals( ProjectDependencyGraphStub.A ) )
    {
        return getProjectAExceutionPlan();
    }
    if ( project.equals( ProjectDependencyGraphStub.B ) )
    {
        return getProjectBExecutionPlan();
    }
    // The remaining are basically "for future expansion"
    List<MojoExecution> me = new ArrayList<MojoExecution>();
    me.add( createMojoExecution( "resources", "default-resources", PROCESS_RESOURCES ) );
    me.add( createMojoExecution( "compile", "default-compile", COMPILE ) );
    return createExecutionPlan( project, me );
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public static MavenExecutionPlan getProjectAExceutionPlan()
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    List<MojoExecution> me = new ArrayList<MojoExecution>();
    me.add( createMojoExecution( "initialize", "default-initialize", INITIALIZE ) );
    me.add( createMojoExecution( "resources", "default-resources", PROCESS_RESOURCES ) );
    me.add( createMojoExecution( "compile", "default-compile", COMPILE ) );
    me.add( createMojoExecution( "testResources", "default-testResources", PROCESS_TEST_RESOURCES ) );
    me.add( createMojoExecution( "testCompile", "default-testCompile", TEST_COMPILE ) );
    me.add( createMojoExecution( "test", "default-test", TEST ) );
    me.add( createMojoExecution( "war", "default-war", PACKAGE ) );
    me.add( createMojoExecution( "install", "default-install", INSTALL ) );
    return createExecutionPlan( ProjectDependencyGraphStub.A.getExecutionProject(), me );
}
项目:wildfly-swarm    文件:MultiStartMojo.java   
@SuppressWarnings("unchecked")
protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException {
    Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin");

    Xpp3Dom config = getConfiguration(project, executionId);
    Xpp3Dom processConfig = getProcessConfiguration(process);

    Xpp3Dom globalConfig = getGlobalConfig();
    Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config);
    mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig);

    PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession);
    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start");
    MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig);
    mavenSession.setCurrentProject(project);
    this.pluginManager.executeMojo(mavenSession, mojoExecution);

    List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get(SWARM_PROCESS);

    List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get(SWARM_PROCESS);

    if (procs == null) {
        procs = new ArrayList<>();
        getPluginContext().put(SWARM_PROCESS, procs);
    }

    procs.addAll(launched);

    mavenSession.setCurrentProject(this.project);
}
项目:ARCHIVE-wildfly-swarm    文件:MultiStartMojo.java   
@SuppressWarnings("unchecked")
protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException {
    Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin");

    Xpp3Dom config = getConfiguration(project, executionId);
    Xpp3Dom processConfig = getProcessConfiguration(process);

    Xpp3Dom globalConfig = getGlobalConfig();
    Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config);
    mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig);

    PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession);
    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start");
    MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig);
    mavenSession.setCurrentProject(project);
    this.pluginManager.executeMojo(mavenSession, mojoExecution);

    List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get("swarm-process");

    List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get("swarm-process");

    if (procs == null) {
        procs = new ArrayList<>();
        getPluginContext().put("swarm-process", procs);
    }

    procs.addAll(launched);

    mavenSession.setCurrentProject(this.project);
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    return calculateExecutionPlan( session, project, tasks, true );
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
private void setupMojoExecutions( MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    for ( MojoExecution mojoExecution : mojoExecutions )
    {
        setupMojoExecution( session, project, mojoExecution );
    }
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project,
                                                     List<Object> tasks )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginVersionResolutionException, LifecyclePhaseNotFoundException
{
    final List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();

    for ( Object task : tasks )
    {
        if ( task instanceof GoalTask )
        {
            String pluginGoal = ( (GoalTask) task ).pluginGoal;

            MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project );

            MojoExecution mojoExecution =
                new MojoExecution( mojoDescriptor, "default-cli", MojoExecution.Source.CLI );

            mojoExecutions.add( mojoExecution );
        }
        else if ( task instanceof LifecycleTask )
        {
            String lifecyclePhase = ( (LifecycleTask) task ).getLifecyclePhase();

            Map<String, List<MojoExecution>> phaseToMojoMapping =
                calculateLifecycleMappings( session, project, lifecyclePhase );

            for ( List<MojoExecution> mojoExecutionsFromLifecycle : phaseToMojoMapping.values() )
            {
                mojoExecutions.addAll( mojoExecutionsFromLifecycle );
            }
        }
        else
        {
            throw new IllegalStateException( "unexpected task " + task );
        }
    }
    return mojoExecutions;
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<MojoDescriptor>() );
}
项目:oceano    文件:DefaultLifecycleExecutionPlanCalculator.java   
private List<MojoExecution> calculateForkedGoal( MojoExecution mojoExecution, MavenSession session,
                                                 MavenProject project,
                                                 Collection<MojoDescriptor> alreadyForkedExecutions )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

    PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();

    String forkedGoal = mojoDescriptor.getExecuteGoal();

    MojoDescriptor forkedMojoDescriptor = pluginDescriptor.getMojo( forkedGoal );
    if ( forkedMojoDescriptor == null )
    {
        throw new MojoNotFoundException( forkedGoal, pluginDescriptor );
    }

    if ( alreadyForkedExecutions.contains( forkedMojoDescriptor ) )
    {
        return Collections.emptyList();
    }

    MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal );

    populateMojoExecutionConfiguration( project, forkedExecution, true );

    finalizeMojoConfiguration( forkedExecution );

    calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions );

    return Collections.singletonList( forkedExecution );
}
项目:oceano    文件:DefaultLifecycleExecutor.java   
@SuppressWarnings( { "UnusedDeclaration" } )
MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project, String invokedVia,
                                  boolean canUsePrefix, boolean isOptionalMojo )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginVersionResolutionException
{
    return mojoDescriptorCreator.getMojoDescriptor( task, session, project );
}
项目:oceano    文件:DefaultLifecycleExecutor.java   
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
    PluginVersionResolutionException
{
    return calculateExecutionPlan( session, true, tasks );
}
项目:oceano    文件:DefaultLifecycleExecutor.java   
public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    lifecycleExecutionPlanCalculator.calculateForkedExecutions( mojoExecution, session );
}
项目:oceano    文件:DefaultProjectBuildingHelper.java   
private List<Artifact> resolveExtensionArtifacts( Plugin extensionPlugin, List<RemoteRepository> repositories,
                                                  ProjectBuildingRequest request )
    throws PluginResolutionException
{
    DependencyNode root =
        pluginDependenciesResolver.resolve( extensionPlugin, null, null, repositories,
                                            request.getRepositorySession() );

    PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
    root.accept( nlg );
    return nlg.getArtifacts( false );
}
项目:oceano    文件:DefaultMavenPluginManager.java   
public synchronized void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session,
                                           ClassLoader parent, List<String> imports, DependencyFilter filter )
    throws PluginResolutionException, PluginContainerException
{
    Plugin plugin = pluginDescriptor.getPlugin();

    MavenProject project = session.getCurrentProject();

    Map<String, ClassLoader> foreignImports = calcImports( project, parent, imports );

    PluginRealmCache.Key cacheKey =
        pluginRealmCache.createKey( plugin, parent, foreignImports, filter, project.getRemotePluginRepositories(),
                                    session.getRepositorySession() );

    PluginRealmCache.CacheRecord cacheRecord = pluginRealmCache.get( cacheKey );

    if ( cacheRecord != null )
    {
        pluginDescriptor.setClassRealm( cacheRecord.realm );
        pluginDescriptor.setArtifacts( new ArrayList<Artifact>( cacheRecord.artifacts ) );
        for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
        {
            componentDescriptor.setRealm( cacheRecord.realm );
        }
    }
    else
    {
        createPluginRealm( pluginDescriptor, session, parent, foreignImports, filter );

        cacheRecord =
            pluginRealmCache.put( cacheKey, pluginDescriptor.getClassRealm(), pluginDescriptor.getArtifacts() );
    }

    pluginRealmCache.register( project, cacheRecord );
}
项目:oceano    文件:LifecycleWeaveBuilderTest.java   
private ProjectBuildList runWithCompletionService( ExecutorService service )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
    ExecutionException, InterruptedException
{
    final ClassLoader loader = Thread.currentThread().getContextClassLoader();
    try
    {
        BuildListCalculator buildListCalculator = new BuildListCalculator();
        final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
        List<TaskSegment> taskSegments = getTaskSegmentCalculator().calculateTaskSegments( session );
        ProjectBuildList projectBuildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );

        final MojoExecutorStub mojoExecutorStub = new MojoExecutorStub();
        final LifecycleWeaveBuilder builder = getWeaveBuilder( mojoExecutorStub );
        final ReactorContext buildContext = createBuildContext( session );
        ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() );
        builder.build( projectBuildList, buildContext, taskSegments, session, service, reactorBuildStatus );

        LifecycleExecutionPlanCalculatorStub lifecycleExecutionPlanCalculatorStub =
            new LifecycleExecutionPlanCalculatorStub();
        final int expected = lifecycleExecutionPlanCalculatorStub.getNumberOfExceutions( projectBuildList );
        assertEquals( "All executions should be scheduled", expected, mojoExecutorStub.executions.size() );
        return projectBuildList;
    }
    finally
    {
        Thread.currentThread().setContextClassLoader( loader );
    }
}
项目:oceano    文件:ThreadOutputMuxerTest.java   
private ProjectBuildList getProjectBuildList()
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
    return ProjectDependencyGraphStub.getProjectBuildList( session );
}
项目:oceano    文件:ConcurrencyDependencyGraphTest.java   
public void testConcurrencyGraphPrimaryVersion()
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    ProjectDependencyGraph dependencyGraph = new ProjectDependencyGraphStub();
    final MavenSession session = ProjectDependencyGraphStub.getMavenSession();

    ConcurrencyDependencyGraph graph =
        new ConcurrencyDependencyGraph( getProjectBuildList( session ), dependencyGraph );

    final List<MavenProject> projectBuilds = graph.getRootSchedulableBuilds();
    assertEquals( 1, projectBuilds.size() );
    assertEquals( A, projectBuilds.get( 0 ) );

    final List<MavenProject> subsequent = graph.markAsFinished( A );
    assertEquals( 2, subsequent.size() );
    assertEquals( ProjectDependencyGraphStub.B, subsequent.get( 0 ) );
    assertEquals( C, subsequent.get( 1 ) );

    final List<MavenProject> bDescendants = graph.markAsFinished( B );
    assertEquals( 1, bDescendants.size() );
    assertEquals( Y, bDescendants.get( 0 ) );

    final List<MavenProject> cDescendants = graph.markAsFinished( C );
    assertEquals( 2, cDescendants.size() );
    assertEquals( X, cDescendants.get( 0 ) );
    assertEquals( Z, cDescendants.get( 1 ) );
}
项目:oceano    文件:ProjectDependencyGraphStub.java   
public static ProjectBuildList getProjectBuildList( MavenSession session )
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    final List<ProjectSegment> list = getProjectBuilds( session );
    return new ProjectBuildList( list );

}
项目:oceano    文件:ProjectDependencyGraphStub.java   
private static ProjectSegment createProjectBuild( MavenProject project, MavenSession session,
                                                  TaskSegment taskSegment )
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    final MavenSession session1 = session.clone();
    return new ProjectSegment( project, taskSegment, session1 );
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public int getNumberOfExceutions( ProjectBuildList projectBuildList )
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    int result = 0;
    for ( ProjectSegment projectBuild : projectBuildList )
    {
        MavenExecutionPlan plan = calculateExecutionPlan( projectBuild.getSession(), projectBuild.getProject(),
                                                          projectBuild.getTaskSegment().getTasks() );
        result += plan.size();
    }
    return result;
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    // Maybe do something ?
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    return calculateExecutionPlan( session, project, tasks, true );
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
public static MavenExecutionPlan getProjectBExecutionPlan()
    throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
{
    List<MojoExecution> me = new ArrayList<MojoExecution>();
    me.add( createMojoExecution( "enforce", "enforce-versions", VALIDATE ) );
    me.add( createMojoExecution( "resources", "default-resources", PROCESS_RESOURCES ) );
    me.add( createMojoExecution( "compile", "default-compile", COMPILE ) );
    me.add( createMojoExecution( "testResources", "default-testResources", PROCESS_TEST_RESOURCES ) );
    me.add( createMojoExecution( "testCompile", "default-testCompile", TEST_COMPILE ) );
    me.add( createMojoExecution( "test", "default-test", TEST ) );
    return createExecutionPlan( ProjectDependencyGraphStub.B.getExecutionProject(), me );
}
项目:oceano    文件:LifecycleExecutionPlanCalculatorStub.java   
private static MavenExecutionPlan createExecutionPlan( MavenProject project, List<MojoExecution> mojoExecutions )
    throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
    NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException
{
    final List<ExecutionPlanItem> planItemList =
        DefaultSchedulesStub.createDefaultSchedules().createExecutionPlanItem( project, mojoExecutions );
    return new MavenExecutionPlan( planItemList, DefaultLifecyclesStub.createDefaultLifecycles() );
}
项目:incubator-netbeans    文件:MavenModelProblemsProvider.java   
@NbBundle.Messages({
    "TXT_Artifact_Resolution_problem=Artifact Resolution problem",
    "TXT_Artifact_Not_Found=Artifact Not Found",
    "TXT_Cannot_Load_Project=Unable to properly load project",
    "TXT_Cannot_read_model=Error reading project model",
    "TXT_NoMsg=Exception thrown while loading maven project at {0}. See messages.log for more information."
})
private Collection<ProjectProblem> reportExceptions(MavenExecutionResult res) {
    List<ProjectProblem> toRet = new ArrayList<ProjectProblem>();
    for (Throwable e : res.getExceptions()) {
        LOG.log(Level.FINE, "Error on loading project " + project.getProjectDirectory(), e);
        if (e instanceof ArtifactResolutionException) { // XXX when does this occur?
            toRet.add(ProjectProblem.createError(TXT_Artifact_Resolution_problem(), getDescriptionText(e)));
            problemReporter.addMissingArtifact(((ArtifactResolutionException) e).getArtifact());

        } else if (e instanceof ArtifactNotFoundException) { // XXX when does this occur?
            toRet.add(ProjectProblem.createError(TXT_Artifact_Not_Found(), getDescriptionText(e)));
            problemReporter.addMissingArtifact(((ArtifactNotFoundException) e).getArtifact());
        } else if (e instanceof ProjectBuildingException) {
            toRet.add(ProjectProblem.createError(TXT_Cannot_Load_Project(), getDescriptionText(e), new SanityBuildAction(project)));
            if (e.getCause() instanceof ModelBuildingException) {
                ModelBuildingException mbe = (ModelBuildingException) e.getCause();
                for (ModelProblem mp : mbe.getProblems()) {
                    LOG.log(Level.FINE, mp.toString(), mp.getException());
                    if (mp.getException() instanceof UnresolvableModelException) {
                        // Probably obsoleted by ProblemReporterImpl.checkParent, but just in case:
                        UnresolvableModelException ume = (UnresolvableModelException) mp.getException();
                        problemReporter.addMissingArtifact(EmbedderFactory.getProjectEmbedder().createProjectArtifact(ume.getGroupId(), ume.getArtifactId(), ume.getVersion()));
                    } else if (mp.getException() instanceof PluginResolutionException) {
                        Plugin plugin = ((PluginResolutionException) mp.getException()).getPlugin();
                        // XXX this is not actually accurate; should rather pick out the ArtifactResolutionException & ArtifactNotFoundException inside
                        problemReporter.addMissingArtifact(EmbedderFactory.getProjectEmbedder().createArtifact(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), "jar"));
                    } else if (mp.getException() instanceof PluginManagerException) {
                        PluginManagerException ex = (PluginManagerException) mp.getException();                            
                        problemReporter.addMissingArtifact(EmbedderFactory.getProjectEmbedder().createArtifact(ex.getPluginGroupId(), ex.getPluginArtifactId(), ex.getPluginVersion(), "jar"));
                    }
                }
            }
        } else {
            String msg = e.getMessage();
            if(msg != null) {
                LOG.log(Level.INFO, "Exception thrown while loading maven project at " + project.getProjectDirectory(), e); //NOI18N
                toRet.add(ProjectProblem.createError(TXT_Cannot_read_model(), msg));
            } else {
                String path = project.getProjectDirectory().getPath();
                toRet.add(ProjectProblem.createError(TXT_Cannot_read_model(), TXT_NoMsg(path)));
                LOG.log(Level.WARNING, "Exception thrown while loading maven project at " + path, e); //NOI18N
            }
        }
    }
    return toRet;
}
项目:iterator-maven-plugin    文件:IteratorMojo.java   
private PluginDescriptor getPluginDescriptor( Plugin plugin )
    throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
{
    return mavenPluginManagerHelper.getPluginDescriptor( plugin, getMavenProject().getRemotePluginRepositories(),
                                                         getMavenSession() );
}
项目:oceano    文件:LifecycleExecutor.java   
MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
PluginVersionResolutionException;