Examples of ArchetypeGenerationResult


Examples of org.apache.maven.archetype.ArchetypeGenerationResult

                setArchetypeVersion( generatedArchetypeProject.getVersion() ).
                setGroupId( "com.mycompany" ).setArtifactId( "myapp" ).setVersion( "1.0-SNAPSHOT" ).
                setPackage( "com.mycompany.myapp" ).setProperties( properties ).
                setOutputDirectory( outputDirectory ).setLocalRepository( localRepository ).
                setArchetypeRepository( "http://localhost:" + port + "/repo/" );
        ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( agr );

        if ( generationResult.getCause() != null )
        {
            throw generationResult.getCause();
        }

        //ASSERT symbol_pound replacement (archetype-180 archetype-183)
        String content = FileUtils.fileRead(
            outputDirectory + File.separator + "myapp" + File.separator + "src" + File.separator + "main"
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

                setArchetypeArtifactId( generatedArchetypeProject.getArtifactId() ).
                setArchetypeVersion( generatedArchetypeProject.getVersion() ).
                setGroupId( "com.mycompany" ).setArtifactId( "myapp" ).setVersion( "1.0-SNAPSHOT" ).
                setPackage( "com.mycompany.myapp" ).setOutputDirectory( outputDirectory ).
                setLocalRepository( localRepository ).setArchetypeRepository( "http://localhost:" + port + "/repo" );
        ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( agr );

        if ( generationResult.getCause() != null )
        {
            throw generationResult.getCause();
        }

    }
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

    File projectDirectory;

    private void generateProjectFromArchetype( ArchetypeGenerationRequest request )
        throws Exception
    {
        ArchetypeGenerationResult result = new ArchetypeGenerationResult();

        generator.generateArchetype( request, result );

        if ( result.getCause() != null )
        {
            throw result.getCause();
        }
    }
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

    }

    private ArchetypeGenerationResult generateProjectFromArchetypeWithFailure( ArchetypeGenerationRequest request )
        throws Exception
    {
        ArchetypeGenerationResult result = new ArchetypeGenerationResult();

        generator.generateArchetype( request, result );

        if ( result.getCause() == null )
        {
            fail( "Exception must be thrown." );
        }

        return result;
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

        Archetype archetype = new Archetype( "archetypes", null, "1.0" );

        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-2", archetype );

        ArchetypeGenerationResult result = generateProjectFromArchetypeWithFailure( request );

        assertEquals( "Exception not correct", "The archetype is not defined", result.getCause().getMessage() );
    }
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-3", ARCHETYPE_BASIC );
       
        request.setProperties( new Properties() );

        ArchetypeGenerationResult result = generateProjectFromArchetypeWithFailure( request );

        assertTrue( "Exception not correct",
                    result.getCause().getMessage().startsWith( "Archetype archetypes:basic:1.0 is not configured" )
                        && result.getCause().getMessage().endsWith( "Property property-without-default-4 is missing." ) );
    }
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

        archetypeRequiredProperties.setProperty( "property-without-default-4", "some-value-4" );
        agr.setProperties( archetypeRequiredProperties );

        // Then generate away!

        ArchetypeGenerationResult result = archetype.generateProjectFromArchetype( agr );

        if ( result.getCause() != null )
        {
            result.getCause().printStackTrace( System.err );
            fail( result.getCause().getMessage() );
        }
    }
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

                .setArtifactId( "artifactId" + count )
                .setVersion( "version" + count )
                .setPackage( "package" + count )
                .setOutputDirectory( outputDirectory.getPath() )
                .setLocalRepository( localRepository );
            ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( request );
            if ( generationResult != null && generationResult.getCause() != null )
            {
                ar.setVersion( a.getVersion() );
                request =
                    new ArchetypeGenerationRequest( ar )
                    .setGroupId( "groupId" + count )
                    .setArtifactId( "artifactId" + count )
                    .setVersion( "version" + count )
                    .setPackage( "package" + count )
                    .setOutputDirectory( outputDirectory.getPath() )
                    .setLocalRepository( localRepository );
                generationResult = archetype.generateProjectFromArchetype( request );
                if ( generationResult != null && generationResult.getCause() != null )
                {
                    archetypesRemoved.add( a );
                }
                else
                {
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

            generatedArchetypeProject.getArtifactId() ).setArchetypeVersion(
            generatedArchetypeProject.getVersion() ).setGroupId( "com.mycompany" ).setArtifactId( "myapp" ).setVersion(
            "1.0-SNAPSHOT" ).setPackage( "com.mycompany.myapp" ).setOutputDirectory(
            outputDirectory ).setLocalRepository( localRepository ).setArchetypeRepository(
            "http://localhost:" + port + "/repo/" );
        ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( agr );

        if ( generationResult.getCause() != null )
        {
            fail( generationResult.getCause().getMessage() );
        }

        String myapp = outputDirectory + File.separator + "myapp" + File.separator;
        assertTrue( new File( myapp + "myapp-api", ".classpath" ).exists() );
        assertTrue( new File( myapp + "myapp-cli", ".classpath" ).exists() );
View Full Code Here

Examples of org.apache.maven.archetype.ArchetypeGenerationResult

            if ( ar.getRepository() == null )
            {
                ar.setRepository( CENTRAL );
            }

            ArchetypeGenerationResult releaseGenerationResult = testArchetype( count, ar );

            if ( releaseGenerationResult.getCause() != null )
            {
                // RELEASE version failed: try with the version specified in the Wiki
                ar.setVersion( a.getVersion() );

                ArchetypeGenerationResult generationResult = testArchetype( count, ar );

                if ( generationResult.getCause() == null )
                {
                    if ( !( ar.getVersion().indexOf( "SNAPSHOT" ) > 0 )
                        && !( ar.getVersion().indexOf( "snapshot" ) > 0 ) )
                    {
                        validArchetypes.add( ar );

                        warnings.add( "#" + count + ' ' + ar + ": error for RELEASE - " + releaseGenerationResult.getCause().getMessage() );
                    }
                }
                else
                {
                    errors.add( "#" + count + ' ' + ar + ' ' + generationResult.getCause().getMessage() );
                }
            }
            else
            {
                validArchetypes.add( ar );
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.