Examples of Archetype


Examples of io.fabric8.tooling.archetype.catalog.Archetype

    }

    @Override
    protected Object doExecute() throws Exception {
        // try artifact first
        Archetype archetype = archetypeService.getArchetypeByArtifact(archetypeGAV);
        if (archetype == null) {
            // then by coordinate
            archetypeService.getArchetype(archetypeGAV);
        }
        if (archetype != null) {
View Full Code Here

Examples of io.fabric8.tooling.archetype.catalog.Archetype

public class ArchetypeXmlTest {

    @Test
    public void testMarshalArchetypes() throws JAXBException {
        Archetypes archetypes = new Archetypes();
        archetypes.add(new Archetype("foo", "bar", "1.1", "Some name", "Some description"));
        archetypes.add(new Archetype("xyz", "whatever", "2.3", "Some other name", "Docs..."));

        StringWriter buffer = new StringWriter();
        Archetypes.newMarshaller().marshal(archetypes, buffer);

        System.out.println("Generated XML: " + buffer);
View Full Code Here

Examples of io.fabric8.tooling.archetype.catalog.Archetype

        if (!target.exists() || !target.isDirectory()) {
            System.err.println("Workspace does not exists or is not a directory: " + directory);
            return null;
        }

        Archetype archetype = null;

        // try artifact first
        if (!isNullOrBlank(archetypeOrFilter)) {
            archetype = archetypeService.getArchetypeByArtifact(archetypeOrFilter);
            if (archetype == null) {
                // then by coordinate
                archetype = archetypeService.getArchetype(archetypeOrFilter);
            }
        }

        // no archetype yet so present a list where the user can select
        while (archetype == null) {
            List<Archetype> archetypes = archetypeService.listArchetypes(archetypeOrFilter, true);

            System.out.println("Choose archetype:");
            Iterator<Archetype> it = archetypes.iterator();
            int i = 0;
            while (it.hasNext()) {
                Archetype select = it.next();
                System.out.println(String.format("%4d: -> %-50s %s", ++i, select.artifactId, select.description));
            }

            boolean choosing = true;
            while (choosing) {
View Full Code Here

Examples of org.apache.maven.archetype.Archetype

    protected void createTestProject(String archetypeArtifactId, String archetypeVersion) throws Exception {
        MavenProject project = getMavenProject();
        FileUtils.deleteDirectory(getTestFile("target/" + project.getArtifactId()));

        Archetype archetype = (Archetype) lookup(Archetype.ROLE);

        String localRepoPath = System.getProperty( "localRepoPath" );

        if (StringUtils.isEmpty(localRepoPath)) {
            localRepoPath =  System.getProperty("user.home") + System.getProperty("file.separator") +
                            ".m2" + System.getProperty("file.separator") + "repository";
        }

        String mavenRepoLocal = "file://" + localRepoPath;

        ArtifactRepositoryLayout layout =
                (ArtifactRepositoryLayout) container.lookup(ArtifactRepositoryLayout.ROLE, "default");
       
        ArtifactRepository localRepository = new DefaultArtifactRepository("local", mavenRepoLocal, layout);

        List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();

        String archetypeGroupId = "org.appfuse.archetypes";

        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
        request.setGroupId(project.getGroupId()).setArtifactId(project.getArtifactId()).setVersion("1.0-SNAPSHOT");
        request.setArchetypeGroupId(archetypeGroupId).setArchetypeArtifactId(archetypeArtifactId);
        request.setArchetypeVersion(archetypeVersion);
        request.setLocalRepository(localRepository);
        request.setRemoteArtifactRepositories(remoteRepositories);
        request.setOutputDirectory(getTestFile("target").getAbsolutePath());

        archetype.generateProjectFromArchetype(request);
    }
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

                    archetypeCatalogs.size());

            for (Archetype candidate : candidates) {
                if (getWizard().acceptsArchetype(candidate)) {
                    String key = keyFor(candidate);
                    Archetype old = archetypesMap.put(key, candidate);

                    logger.trace("Registered archetype {0}", candidate);

                    if (old == null || !old.equals(candidate)) {
                        changed = true;
                    }

                    logger.trace("Old archetype was {0}, changed = {1}", old, changed);
                }
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

  private void initialize() {
    if (propertiesTable==null) {
      return;
    }
   
    Archetype archetype = parent.getChooseArchetypePage().getSelectedArchetype();
    if (archetype==null) {
      return;
    }
   
        try {
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

                    IOUtils.closeQuietly(fos);
                    FileUtils.deleteQuietly(tmpFile);
                }
            }

            Archetype archetype = new Archetype();
            archetype.setGroupId(groupId);
            archetype.setArtifactId(artifactId);
            archetype.setVersion(version);
            org.apache.maven.archetype.Archetype archetyper = MavenPluginActivator.getDefault().getArchetype();
            archetyper.updateLocalCatalog(archetype);
        } catch (CoreException e) {
            throw e;
        } catch (RuntimeException e) {
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

  }

  protected List<IProject> createProjects(IProgressMonitor monitor) throws CoreException {

        IPath location = chooseArchetypePage.getLocation();
        Archetype archetype = chooseArchetypePage.getSelectedArchetype();
        String groupId = archetypeParametersPage.getGroupId();
        String artifactId = archetypeParametersPage.getArtifactId();
        String version = archetypeParametersPage.getVersion();
        String javaPackage = archetypeParametersPage.getJavaPackage();
        Properties properties = archetypeParametersPage.getProperties();
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

            final FlatSearchRequest searchRequest = new FlatSearchRequest( pq );
            searchRequest.setContexts( getIndexingContexts() );
            final FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest );
            for ( ArtifactInfo info : searchResponse.getResults() )
            {
                Archetype archetype = new Archetype();
                archetype.setGroupId( info.groupId );
                archetype.setArtifactId( info.artifactId );
                archetype.setVersion( info.version );
                archetype.setDescription( info.description );
                archetype.setRepository( repositories.get( info.repository ) );
                catalog.addArchetype( archetype );
            }
        }
        catch ( Exception ex )
        {
View Full Code Here

Examples of org.apache.maven.archetype.catalog.Archetype

      Assert.assertNotNull(archetypeCatalogFactory);
      ArchetypeCatalog archetypes = archetypeCatalogFactory.getArchetypeCatalog();
      Assert.assertNotNull(archetypes);
      Assert.assertNotNull(archetypes.getArchetypes());
      Assert.assertEquals(1, archetypes.getArchetypes().size());
      Archetype expected = new Archetype();
      expected.setGroupId("groupId");
      expected.setArtifactId("artifactId");
      expected.setVersion("1.0.0");
      expected.setDescription("Description");
      Assert.assertEquals(expected, archetypes.getArchetypes().get(0));
   }
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.