Package org.apache.maven.archetype

Examples of org.apache.maven.archetype.ArchetypeCreationRequest


        MavenProject project = projectBuilder.build( pom, localRepository, null );

        Properties properties = new Properties();
        properties.setProperty( "someProperty", "someValue" );
        ArchetypeCreationRequest acr = new ArchetypeCreationRequest().setProject( project ).
            setLocalRepository( localRepository ).setProperties( properties ).setPostPhase( "package" );

        ArchetypeCreationResult creationResult = archetype.createArchetypeFromProject( acr );

        if ( creationResult.getCause() != null )
View Full Code Here


        // (2) create an archetype from the project
        File pom = new File( workingProject, "pom.xml" );

        MavenProject project = projectBuilder.build( pom, localRepository, null );

        ArchetypeCreationRequest acr = new ArchetypeCreationRequest().setProject( project ).
            setLocalRepository( localRepository ).setPostPhase( "package" );

        ArchetypeCreationResult creationResult = archetype.createArchetypeFromProject( acr );

        if ( creationResult.getCause() != null )
View Full Code Here

        filtereds.add( "properties" );
        filtereds.add( ".classpath" );
        filtereds.add( ".project" );
        filtereds.add( "MF" );

        ArchetypeCreationRequest request = new ArchetypeCreationRequest()
            .setProject( mavenProject )
            .setPackageName( p.getProperty( Constants.PACKAGE ) )
            .setProperties( p )
            .setLanguages( languages )
            .setFiltereds( filtereds )
View Full Code Here

        // (2) create an archetype from the project
        File pom = new File( workingProject, "pom.xml" );

        MavenProject project = projectBuilder.build( pom, localRepository, null );

        ArchetypeCreationRequest acr =
            new ArchetypeCreationRequest().setProject( project ).setLocalRepository( localRepository ).setFiltereds(
                Constants.DEFAULT_FILTERED_EXTENSIONS ).setLanguages( Constants.DEFAULT_LANGUAGES ).setPostPhase(
                "package" );

        ArchetypeCreationResult creationResult = archetype.createArchetypeFromProject( acr );
View Full Code Here

                configurator.configureArchetypeCreation( project, Boolean.valueOf( interactive ), executionProperties,
                                                         propertyFile, languages );

            List<String> filtereds = getFilteredExtensions( archetypeFilteredExtentions, propertyFile );

            ArchetypeCreationRequest request = new ArchetypeCreationRequest()
                .setDefaultEncoding( defaultEncoding )
                .setProject( project )
                /* Used when in interactive mode */
                .setProperties( properties )
                .setLanguages( languages )
View Full Code Here

        ArchetypeCreationConfigurator configurator = plexus.lookup(ArchetypeCreationConfigurator.class);
        Properties config = configurator.configureArchetypeCreation(project, !batch, props, null, languages);

        RepositorySystem rsys = plexus.lookup(RepositorySystem.class);

        ArchetypeCreationRequest request = new ArchetypeCreationRequest()
            .setProject(project)
            .setProperties(config)
            .setLanguages(languages)
            .setFilteredExtensions(filteredExtensions)
            .setPreserveCData(preserveCDATA)
            .setKeepParent(keepParent)
            .setPartialArchetype(partial)
            .setLocalRepository(rsys.createDefaultLocalRepository())
            .setPackageName(packageName);

        if (registryFile == null) {
            File dir = vars.get(SHELL_USER_HOME, File.class);
            registryFile = new File(dir, ".m2/archetype.xml");
        }
        request.setArchetypeRegistryFile(registryFile);

        if (outputDirectory != null) {
            request.setOutputDirectory(outputDirectory);
        }
        else {
            // HACK: Default dir is not rooted
            System.setProperty("user.dir", vars.get(SHELL_USER_DIR, File.class).getAbsolutePath());
        }

        log.debug("Creating archetype");
        ArchetypeManager archetypeManager = plexus.lookup(ArchetypeManager.class);
        ArchetypeCreationResult result = archetypeManager.createArchetypeFromProject(request);

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

        // HACK: Prompter has some issues, so add a newline
        io.out.println();

        io.println("Archetype created in: {}", request.getOutputDirectory().getAbsolutePath()); // TODO: i18n

        return Result.SUCCESS;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archetype.ArchetypeCreationRequest

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.