Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2242

Programmatically adding maven archetype catalog - is shown as unknown in archetype-list

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.15.0.Final
    • 2.14.0.Final
    • None
    • None

      When installing the Camel forge commands we want to install the Camel archetypes as a catalog out of the box.

      I got some code that does that (but currently coded to include all from central, but we will filter out this later)

          // TODO: Remove when when using Forge 2.14.1+
          void startup(@Observes @Local PostStartup startup, ArchetypeCatalogFactoryRegistry registry) {
      //        registry.addArchetypeCatalogFactory(this);
      
              try {
                  URL url = new URL("http://repo2.maven.org/maven2/archetype-catalog.xml");
                  String defaultRepo = extractRepository(url);
                  registry.addArchetypeCatalogFactory("central", url, defaultRepo);
              } catch (MalformedURLException e) {
                  logger.log(Level.SEVERE, "Error while retrieving archetypes", e);
              }
          }
      

      But the archeype-list command shows this as unknown.

      [forge-distribution-2.14.0.Final]$ addon-install --coordinate io.fabric8.forge:camel,2.2-SNAPSHOT
      ***SUCCESS*** Addon io.fabric8.forge:camel,2.2-SNAPSHOT was installed successfully.
      [forge-distribution-2.14.0.Final]$ archetype-list
      central = unknown
      

      If I add the archetype manually using archetype-add then the url is listed correctly.

      As I am using the add command that takes an URL then it should be shown

         void addArchetypeCatalogFactory(String name, URL catalogURL, String defaultRepositoryName);
      

              rhn-support-ggastald George Gastaldi
              cibsen@redhat.com Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: