With my fabric8 hat on, I was hoping we could add a Karaf CLI command first inside the fabric8 project ;). We have a static list of archetypes in fabric8 (they are all generated programatically too which helps ;), the code to generate them (ArchetypeHelper); so we just need 2 Java classes writing for the Karaf/Gogo shell and we’re done ;) 

e.g. adding a command like this into the existing fabric-agent-commands module in fabric8:

  project-create outputFolderPath mvn:group/artifact….

which to start with doesn’t have any discovery; it just uses the given output folder and mvn coordinates of the archetype and runs the ArchetypeHelper; prompting users to complete/override any values.


Step 2 is to make the archetypes easily discoverable from inside fabric8 itself; via a kind of properties file we can use inside fabric8; which we can then release these properties files into maven repositories. So then folks could type:

  project-create outputFolderPath 

  There are 20 known projects; enter a filter or hit return to see them all: camel

  Searched for camel:

  [1] camel-cdi
  [2] camel-spring

  Select the project to create : _

etc

  
Step 3 is to add something like this into Forge (i.e. the discovery & ArchetypeHelper invocation) and to figure out how different projects can help curate collections of archetypes so they are easy to add/remove from Forge without having to use the horrid “archetype catalog” search in maven which is so hit and miss.

e.g. in Forge we probably want to ‘add’ or ‘remove’ archetype templates.


On 5 Jun 2014, at 15:30, Grzegorz Grzybek <ggrzybek@redhat.com> wrote:
Hello

Finally I have time to start the discussion about the use of Maven Archetypes in both JBoss Fuse and JBoss Fabric.

Here are the links to relevant issues:
 - https://issues.jboss.org/browse/FORGE-273
 - https://github.com/fabric8io/fabric8/issues/1091

Currently we have (here: https://github.com/fabric8io/fabric8/blob/master/tooling/camel-tooling-util/src/main/java/io/fabric8/camel/tooling/util/ArchetypeHelper.java) a helper which can unpack maven archetype and correctly replace ${VAR} variables in archetype resources.

Let's first say what we want to achieve. I'd say (please provide comments if I misunderstood something):
Basic:
 - to be able to unpack any Maven Archetype JAR and create working ("mvn clean install"able) project in FileSystem without using Maven archetype-related libraries
 - to be able to replace variables in archetype resources
 - to be able to evaluate Velocity expressions (they may be present in the archetypes)
Discovery:
 - to be able to read list of available archetypes
 - to be able to discover available archetypes and create the above list (explicit distinction to free ourselves from finding the archetypes in M2_REPO each time)
Help:
 - to be able to discover archetype parameters (this is the main goal - to make something more user/tab-completion friendly than "mvn archetype:create" with millions of options)
 - to provide commands (Karaf/Gogo or JBoss Forge) for project creation
 - to ask users (GUI? Console? Hawt.io?) for required archetype:create params

OK. I'd like to start a project (https://github.com/forge/ or https://github.com/fusesource/ or https://github.com/jboss/ or https://github.com/jboss-fuse/ - any suggestions?) which will do most of the above and will be a foundation of:
 - karaf/fabric command
 - Forge addon(?)

Any suggestions?

---
regards
Grzegorz Grzybek


That sounds good. Please post to forge-dev@lists.jboss.org when you want help getting this rolling!


On Wed, May 21, 2014 at 9:10 AM, James Strachan <jstracha@redhat.com> wrote:
Hey :) 

The scala code is ported to Java now; why don’t we get the little ‘project creator’ command in fabric8 working; then when its there, we could post it to the forge list to see about including/sharing/reusing the same stuff there too?

On 21 May 2014, at 12:33, Grzegorz Grzybek <ggrzybek@redhat.com> wrote:
Hello - sorry I couldn't start the discussion... But I still remember that it's quite important ;)

regards
Grzegorz Grzybek
I think that sounds like a good idea. If we can consume this as a library, it would make things very easy to implement. It would also probably give you guys a migration path so you don't immediately have to jump to Forge on drop 0.

Forge has a number of ways of locating resources, we can come up with a nice pattern for this :)

Shall we move this discussion to forge-dev@lists.jboss.org or #forge on irc.freenode.net and get started?

~Lincoln


On Thu, May 15, 2014 at 3:13 AM, James Strachan <jstracha@redhat.com> wrote:
Yeah, we might wanna polish the archetype generator code into its own jar/bundle thats got minimal dependencies & is easier to use stand alone (so it could be more easily consumed from inside Forge).

For the ‘create project’ command/plugin I figured we’d discover the available archetypes on the classpath somehow; in Fuse IDE (the Fuse/Camel plugins now in JBDS) we just did a bit of code generation to put the archetype jars inside the plugin.  Something a bit more extensible, eventually, might be nice for Forge; though for fabric8 just having a curated list of archetypes from the fabric8 project itself will be fine for us for a while ;)


On 15 May 2014, at 08:03, Grzegorz Grzybek <ggrzybek@redhat.com> wrote:
Hello!
Awesome, thanks Grzegorz!

BTW a bit of background for you, sorry I should have said - there’s been discussions in the past of adding a nice ability to create new projects from archetypes nicely into JBoss Forge:


the mvn command line to generate archetypes isn’t awesome ;) and we could curate a nice default set with auto-completion of all the known jboss archetypes from our projects (and maybe have a nice little way to filter them by tag/project name/tech etc) with tab completion etc
Thanks for links - so another item on my TODO list ;)
I'll think about how to make it easier both for Forge and commands inside Fabric8.

regards
Grzegorz

On 15 May 2014, at 07:55, Grzegorz Grzybek <ggrzybek@redhat.com> wrote:
Hello!

I successfully ported insight-maven stuff from Scala (it's Maven's Aether concept to deal with repositories). But now I'm 30% in camel-tooling-util. Scala is not really needed here and I see it has much more cons than pros!
I know that for Scala ninjas this language is the ultimate expression tool, but reading it after few years is not such a Zen experience after all.

As someone said - Java8 is the new Java, not Scala. Of course I don't want to rewrite all this code into lambda-spaghetti, but good old Java6 syntax is enough :)

And after porting camel-tooling-util back to Java, I'll look at https://github.com/fabric8io/fabric8/issues/1091 which is about making creating projects from archetypes much easier.

regards
Grzegorz
Cool; wanna CC Grzegorz and myself?; am hoping at some point Grzegorz gets the chance to port the existing Archetype creation code from scala to java so its a little leaner & meaner and easier to reuse in Forge.

On 14 May 2014, at 20:31, Lincoln Baxter, III <lincolnbaxter@gmail.com> wrote:
Okay cool. We'll continue to go down the archetype route and see if we can get that working for you guys. It would help if we had someone on your team who could take point on this so we can assist. Is that possible?


On Wed, May 14, 2014 at 3:29 PM, James Strachan <jstracha@redhat.com> wrote:
Ah yeah - just chatted to Dave; this is some gem based stuff for generating projects from templates; which is cool too. We went the maven archetype direction in Fuse IDE (now the Fuse / Camel tooling in JBDS) and now have lots of archetypes (both on upstream projects like camel & cxf and in JBoss Fuse); so I’m personally more keen to support archetypes ASAP; but the more tooling and options the better! :) 

On 14 May 2014, at 17:58, Lincoln Baxter, III <lincolnbaxter@gmail.com> wrote:

https://issues.jboss.org/browse/FORGE-273

Also just got contacted by some people from GSS who are working on fusegen and want to merge that into Forge. Do you know anything about that?
 
Wai Chun Hoi, and Dave Stanley.

~Lincoln


On Wed, Apr 16, 2014 at 11:50 AM, James Strachan <jstracha@redhat.com> wrote:
Sounds cool; am around until about 2-3pm I think so late morning sounds cool.

FWIW we added an archetype generator a while back into eclipse so it was easy for folks to start projects & we pre-baked all our camel/fuse archetypes - as using the maven archetype:generate command line is so utterly awful.

Here’s the code to create an archetype from the mvn coordinates of the archetype distro:
https://github.com/fabric8io/fabric8/blob/master/tooling/camel-tooling-util/src/main/scala/io/fabric8/camel/tooling/util/ArchetypeHelper.scala#L45

e.g. here’s a test case that creates a bunch of archetypes - no maven is required etc:

I was hoping we could cobble something like this into a standard command; then have nice tab completion on the list of archetypes we ship by default in Forge which groks all the jboss / fuse / apache archetypes we want to prime it with; and make it easy for folks to add/load/configure others. e.g. JBoss Fuse ships with a bunch of archetypes (but they are not sync’d to maven central); so it’d be nice if all jboss products that have archetypes were baked into Forge (e.g. EAP / Fuse / Fuse Service Works / BRMS etc).

Hope that helps - would love to port the code to plain java ;) but I guess whats another massive jar dependency on spring-library between friends ;)

Anyway - hope to see you around this morning. Go Errai! :) 



On 16 Apr 2014, at 02:52, Lincoln Baxter, III <lincolnbaxter@gmail.com> wrote:
Let's talk about this tomorrow (today.) I'll be over at the conference in the late morning. And I'll be at the hack-fest.

--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."


James
-------
Red Hat

Twitter: jstrachan, fusenews

Open Source Integration




--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."


James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration




--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."


James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration




James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration




James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration




--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."



James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration




--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."



James
-------
Red Hat

Twitter: @jstrachan
Email: jstracha@redhat.com
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration