[forge-issues] [JBoss JIRA] (FORGE-2243) Programmatically added maven archetype catalog does not work with new-project
Claus Ibsen (JIRA)
issues at jboss.org
Thu Feb 19 08:14:49 EST 2015
[ https://issues.jboss.org/browse/FORGE-2243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041893#comment-13041893 ]
Claus Ibsen commented on FORGE-2243:
------------------------------------
Okay tried with a local build of latest forge code.
I got it working when I manually add the archetype catalog with this code
{code}
void startup(@Observes @Local PostStartup startup, ArchetypeCatalogFactoryRegistry registry) {
// must use this to trigger startup event so we can add ourselves
if (registry.getArchetypeCatalogFactory("camel") == null) {
registry.addArchetypeCatalogFactory(this);
}
}
{code}
When I do this, then using project-new can see the catalog, and I can choose the Camel archetypes I added from my catalog factory.
If I remove this code, then project-new does not see the catalog, and option no 7 is not shown (eg to select from catalog). But when I do archetype-list it shows one catalog
camel = unknown.
So know I know why it shows 2 times before
camel = unknown
camel = unknown
That was because of the post startup code that registers it. But that is needed to make it work.
So we are almost there, but it seems there is a little cat vs dog fight registering custom catalog factory, and what project-new can use.
> Programmatically added maven archetype catalog does not work with new-project
> -----------------------------------------------------------------------------
>
> Key: FORGE-2243
> URL: https://issues.jboss.org/browse/FORGE-2243
> Project: Forge
> Issue Type: Bug
> Affects Versions: 2.14.0.Final
> Reporter: Claus Ibsen
>
> See also FORGE-2242
> When using the new-project command it doesnt work with catalogs that has been added from java code.
> I have added an archetype catalog named "central", eg see FORGE-2242, and when I use it in project-new it fails, as the last output.
> {code}
> [forge-distribution-2.14.0.Final]$ project-new
> ***INFO*** Required inputs not satisfied, entering interactive mode
> ? Project name: mydemo2
> ? Top level package [org.mydemo2]:
> ? Version [1.0.0-SNAPSHOT]:
> ? Final name:
> ? Project location [/opt/forge-distribution-2.14.0.Final]:
> [0] (x) war
> [1] ( ) jar
> [2] ( ) parent
> [3] ( ) addon
> [4] ( ) resource-jar
> [5] ( ) ear
> [6] ( ) from-archetype
> [7] ( ) from-archetype-catalog
> Press <ENTER> to confirm, or <CTRL>+C to cancel.
> ? Project type: [0-7] 7
> [0] (x) Maven
> Press <ENTER> to confirm, or <CTRL>+C to cancel.
> ? Build system: [0]
> [0] ( ) central
> Press <ENTER> to confirm, or <CTRL>+C to cancel.
> ? Catalog: [0]
> ***ERROR*** Catalog must be specified.
> ***ERROR*** Archetype must be specified.
> [forge-distribution-2.14.0.Final]$
> {code}
> But if I add an archetype catalog using archetype-add from the forge shell then it works with project-new, even though they both load the same set of archetypes from maven central.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the forge-issues
mailing list