Package org.apache.maven.plugin

Examples of org.apache.maven.plugin.MojoExecution


        {
            List tasks = (List) lifecycleIterator.next();

            for ( Iterator taskIterator = tasks.iterator(); taskIterator.hasNext(); )
            {
                MojoExecution execution = (MojoExecution) taskIterator.next();

                if ( lifecycleForkers.contains( execution.getMojoDescriptor() ) )
                {
                    taskIterator.remove();
                    getLogger().warn( "Removing: " + execution.getMojoDescriptor().getGoal()
                                      + " from forked lifecycle, to prevent recursive invocation." );
                }
            }
        }
    }
View Full Code Here


                        throw new LifecycleExecutionException( "Mojo: \'" + goal +
                            "\' requires direct invocation. It cannot be used as part of lifecycle: \'" +
                            project.getPackaging() + "\'." );
                    }

                    addToLifecycleMappings( lifecycleMappings, phase, new MojoExecution( mojoDescriptor ),
                                            session.getSettings() );
                }
            }

            if ( phase.equals( selectedPhase ) )
View Full Code Here

            }

            // We have to check to see that the inheritance rules have been applied before binding this mojo.
            if ( execution.isInheritanceApplied() || mojoDescriptor.isInheritedByDefault() )
            {
                MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, execution.getId() );

                String phase = execution.getPhase();

                if ( phase == null )
                {
View Full Code Here

    private MojoExecution getMockMojoExecution()
    {
        MojoDescriptor md = new MojoDescriptor();
        md.setGoal( "compile" );

        MojoExecution me = new MojoExecution( md );

        PluginDescriptor pd = new PluginDescriptor();
        pd.setArtifactId( "maven-compiler-plugin" );
        md.setPluginDescriptor( pd );
View Full Code Here

        MavenSession session = createMavenSession( pom );
        assertEquals( "project-basic", session.getCurrentProject().getArtifactId() );
        assertEquals( "1.0", session.getCurrentProject().getVersion() );
        List<MojoExecution> executionPlan = getExecutions( calculateExecutionPlan( session, "resources:resources" ) );
        assertEquals( 1, executionPlan.size() );
        MojoExecution mojoExecution = executionPlan.get( 0 );
        assertNotNull( mojoExecution );
        assertEquals( "org.apache.maven.plugins",
                      mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
        assertEquals( "maven-resources-plugin",
                      mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
        assertEquals( "0.1", mojoExecution.getMojoDescriptor().getPluginDescriptor().getVersion() );
    }
View Full Code Here

        MavenSession session = createMavenSession( pom );
        assertEquals( "project-basic", session.getCurrentProject().getArtifactId() );
        assertEquals( "1.0", session.getCurrentProject().getVersion() );
        List<MojoExecution> executionPlan = getExecutions( calculateExecutionPlan( session, "clean" ) );
        assertEquals( 1, executionPlan.size() );
        MojoExecution mojoExecution = executionPlan.get( 0 );
        assertNotNull( mojoExecution );
        assertEquals( "org.apache.maven.plugins",
                      mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
        assertEquals( "maven-clean-plugin", mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
        assertEquals( "0.1", mojoExecution.getMojoDescriptor().getPluginDescriptor().getVersion() );
    }
View Full Code Here

        MavenSession session = createMavenSession( pom );
        assertEquals( "project-basic", session.getCurrentProject().getArtifactId() );
        assertEquals( "1.0", session.getCurrentProject().getVersion() );
        List<MojoExecution> executionPlan = getExecutions( calculateExecutionPlan( session, "clean:clean" ) );
        assertEquals( 1, executionPlan.size() );
        MojoExecution mojoExecution = executionPlan.get( 0 );
        assertNotNull( mojoExecution );
        assertEquals( "org.apache.maven.plugins",
                      mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
        assertEquals( "maven-clean-plugin", mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
        assertEquals( "0.1", mojoExecution.getMojoDescriptor().getPluginDescriptor().getVersion() );
    }
View Full Code Here

    public Set<Plugin> getNonThreadSafePlugins()
    {
        Set<Plugin> plugins = new HashSet<Plugin>();
        for ( ExecutionPlanItem executionPlanItem : planItem )
        {
            final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
            if ( !mojoExecution.getMojoDescriptor().isThreadSafe() )
            {
                plugins.add( mojoExecution.getPlugin() );
            }
        }
        return plugins;
    }
View Full Code Here

    public Set<MojoDescriptor> getNonThreadSafeMojos()
    {
        Set<MojoDescriptor> mojos = new HashSet<MojoDescriptor>();
        for ( ExecutionPlanItem executionPlanItem : planItem )
        {
            final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
            if ( !mojoExecution.getMojoDescriptor().isThreadSafe() )
            {
                mojos.add( mojoExecution.getMojoDescriptor() );
            }
        }
        return mojos;
    }
View Full Code Here

            if ( mojoDescriptor == null )
            {
                throw new MojoNotFoundException( entry.getKey(), pluginDescriptor );
            }

            MojoExecution mojoExecution = new MojoExecution( plugin, entry.getKey(), "report:" + entry.getKey() );

            mojoExecution.setConfiguration( convert( mojoDescriptor ) );

            if ( reportPlugin.getConfiguration() != null || entry.getValue() != null )
            {
                Xpp3Dom reportConfiguration =
                    reportPlugin.getConfiguration() == null ? new Xpp3Dom( "fake" )
                                    : convert( reportPlugin.getConfiguration() );

                // MSITE-512 configuration from ReportSet must win
                Xpp3Dom mergedConfigurationWithReportSet =
                    Xpp3DomUtils.mergeXpp3Dom( convert( entry.getValue() ), reportConfiguration );

                Xpp3Dom mergedConfiguration =
                    Xpp3DomUtils.mergeXpp3Dom( mergedConfigurationWithReportSet, convert( mojoDescriptor ) );

                Xpp3Dom cleanedConfiguration = new Xpp3Dom( "configuration" );
                if ( mergedConfiguration.getChildren() != null )
                {
                    for ( Xpp3Dom parameter : mergedConfiguration.getChildren() )
                    {
                        if ( mojoDescriptor.getParameterMap().containsKey( parameter.getName() ) )
                        {
                            cleanedConfiguration.addChild( parameter );
                        }
                    }
                }
                if ( getLog().isDebugEnabled() )
                {
                    getLog().debug( "mojoExecution mergedConfiguration: " + mergedConfiguration );
                    getLog().debug( "mojoExecution cleanedConfiguration: " + cleanedConfiguration );
                }

                mojoExecution.setConfiguration( cleanedConfiguration );
            }

            mojoExecution.setMojoDescriptor( mojoDescriptor );

            mavenPluginManager.setupPluginRealm( pluginDescriptor, mavenReportExecutorRequest.getMavenSession(),
                                                 Thread.currentThread().getContextClassLoader(), IMPORTS, EXCLUDES );
            MavenReport mavenReport =
                getConfiguredMavenReport( mojoExecution, pluginDescriptor, mavenReportExecutorRequest );

            if ( mavenReport == null )
            {
                continue;
            }

            MavenReportExecution mavenReportExecution =
                new MavenReportExecution( mojoExecution.getPlugin(), mavenReport, pluginDescriptor.getClassRealm() );

            lifecycleExecutor.calculateForkedExecutions( mojoExecution, mavenReportExecutorRequest.getMavenSession() );

            if ( !mojoExecution.getForkedExecutions().isEmpty() )
            {
                lifecycleExecutor.executeForkedExecutions( mojoExecution, mavenReportExecutorRequest.getMavenSession() );
            }

            if ( canGenerateReport( mavenReport, mojoExecution ) )
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.MojoExecution

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.