Examples of Mojo


Examples of au.net.ocean.maven.plugin.annotation.Mojo

    }

    private MojoDescriptor extractMojo(Class<?> clazz) throws InvalidPluginDescriptorException {
        getLogger().debug("scanning class: " + clazz.getName());
        MojoDescriptor mojoDescriptor = null;
        Mojo mojo = clazz.getAnnotation(Mojo.class);
        if (mojo != null) {
            getLogger().info("found @Mojo in: " + clazz.getName());
            mojoDescriptor = new MojoDescriptor();
            mojoDescriptor.setLanguage("java");
            mojoDescriptor.setImplementation(clazz.getName());
            mojoDescriptor.setDescription(mojo.description().trim());
            mojoDescriptor.setInstantiationStrategy(mojo.instantiationStrategy().value);
            mojoDescriptor.setExecutionStrategy(mojo.executionStrategy().value);
            String configurator = clazz.getAnnotation(Mojo.class).configurator();
            if (configurator.trim().length() > 0) {
                mojoDescriptor.setComponentConfigurator(configurator.trim());
            }
            mojoDescriptor.setGoal(clazz.getAnnotation(Mojo.class).goal().trim());
            mojoDescriptor.setPhase(mojo.phase().value);
            Execution execute = mojo.execute();
            String lifecycle = execute.lifecycle().trim().length() == 0 ? null : execute.lifecycle().trim();
            String goal = execute.goal().trim().length() == 0 ? null : execute.goal().trim();
            Phase phase = execute.phase();
            if (goal != null || phase != Phase.None) {
                if (goal != null) {
                    if (lifecycle != null) {
                        throw new InvalidPluginDescriptorException("'goal' cannot be specified with 'lifecycle' in execute annotation");
                    }
                    if (phase != Phase.None) {
                        throw new InvalidPluginDescriptorException("execute annotation cannot specify both 'phase' and 'goal'");
                    }
                    mojoDescriptor.setExecuteGoal(goal);
                } else {
                    mojoDescriptor.setExecutePhase(phase.value);
                    if (lifecycle != null) {
                        mojoDescriptor.setExecuteLifecycle(lifecycle);
                    }
                }
            }
            mojoDescriptor.setDependencyResolutionRequired(mojo.requiresDependencyResolution().value);
            mojoDescriptor.setProjectRequired(mojo.requiresProject());
            mojoDescriptor.setAggregator(mojo.aggregator());
            mojoDescriptor.setDirectInvocationOnly(mojo.requiresDirectInvocation());
            mojoDescriptor.setOnlineRequired(mojo.requiresOnline());
            mojoDescriptor.setInheritedByDefault(mojo.inheritByDefault());
            if (mojo.deprecated().trim().length() > 0) {
                mojoDescriptor.setDeprecated(mojo.deprecated());
            }
            // extract parameters working back through the inheritancce hierarchy
            while (!clazz.equals(Object.class)) {
                for (Field field : clazz.getDeclaredFields()) {
                    org.apache.maven.plugin.descriptor.Parameter parameter = extractParameter(field);
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

        List requiredDependencies = new ArrayList();
       
        requiredDependencies.add( "dependencies/test.jar" );
        requiredDependencies.add( "dependencies/test2.jar" );
       
        Mojo mojo = run( pluginConfig, "directory-inline" );
        assertFilesAdded( mojo, requiredDependencies );
    }
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

   
    public void testModuleSetSourceIncludedBinariesNotIncluded() throws Exception
    {
        String pluginConfig = "moduleSetSourceIncludedBinariesNotIncluded-pluginConfig.xml";
       
        Mojo mojo = run( pluginConfig, "attached" );
       
        List required = Collections.singletonList( "sources/module1/src/main/java/org/test/module1/App.java" );
       
        assertFilesAdded( mojo, required );
    }
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

        File pluginConfigFile = new File( getBasedir(), "src/test/plugin-configs/" + pluginConfigResource );
       
        assertTrue( "Cannot find plugin-configuration: \'" + pluginConfigResource + "\' in context-classloader\'s classpath.", pluginConfigFile.exists() );
       
        // TODO: Need to replace this with test-only mojos...
        Mojo mojo = (Mojo) lookupMojo( mojoName, pluginConfigFile.getAbsolutePath() );

        FileLoggingArchiverManagerStub archiverManager = (FileLoggingArchiverManagerStub) getVariableValueFromObject( mojo, "archiverManager" );
        archiverManager.clearArchiver();
       
        mojo.execute();

        return mojo;
    }
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

                                                  MavenReportExecutorRequest mavenReportExecutorRequest )
        throws PluginContainerException, PluginConfigurationException
    {
        try
        {
            Mojo mojo = mavenPluginManager.getConfiguredMojo( Mojo.class,
                                                              mavenReportExecutorRequest.getMavenSession(),
                                                              mojoExecution );

            return (MavenReport) mojo;
        }
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

    private void doConfigTest(String mojoName, String configFile)
        throws Exception
    {
        File testPom =
            new File( getBasedir(), "target/test-classes/unit/skip-test/" + configFile );
        Mojo mojo = lookupMojo( mojoName, testPom );
        assertNotNull( mojo );
        CapturingLog log = new CapturingLog();
        mojo.setLog( log );
        mojo.execute();

        assertTrue( log.getContent().indexOf( "Skipping plugin execution" ) != -1 );
    }
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

    {

        MavenReport mavenReport = null;
        try
        {
            Mojo mojo = mavenPluginManager.getConfiguredMojo( Mojo.class,
                                                              mavenReportExecutorRequest.getMavenSession(),
                                                              mojoExecution );
            if ( !isMavenReport( mojoExecution, pluginDescriptor, mojo ) )
            {
                return null;
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

     */
    public void testCreateClownfish() {
       
        Command command = new Command(null);
       
        Mojo mojo = EasyMock.createMock(Mojo.class);
        Log log = EasyMock.createMock(Log.class);
       
        ClownfishHelper clownfishHelper = EasyMock.createMock(
                ClownfishHelper.class);
       
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

  @Test
    public void testCreateClownfish() {
       
        Command command = new Command();
       
        Mojo mojo = EasyMock.createMock(Mojo.class);
        Log log = EasyMock.createMock(Log.class);
       
        ClownfishHelper clownfishHelper = EasyMock.createMock(
                ClownfishHelper.class);
       
View Full Code Here

Examples of org.apache.maven.plugin.Mojo

            if ( !isMavenReport( mojoExecution, pluginDescriptor ) )
            {
                return null;
            }

            Mojo mojo = mavenPluginManager.getConfiguredMojo( Mojo.class,
                                                              mavenReportExecutorRequest.getMavenSession(),
                                                              mojoExecution );

            return (MavenReport) mojo;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.