Page 1 of 1

Using the ecommerce-archetype

Posted: Mon Dec 05, 2011 2:32 pm
by partyk1d24
So I saw in the new update a folder was added with what looks to be a Maven Archetype for a Broadleaf commerce project under the folder quick-start

Is this really a maven archetype?

How come when I try to build the archetype using..

mvn archetype:generate -DgroupId=org.broadleafcommerce -DartifactId=ecommerce-archetype -DarchetypeArtifactId=maven-archetype-archetype

The package type is set to JAR instead of war?

Re: Using the ecommerce-archetype

Posted: Tue Dec 06, 2011 12:46 pm
by jefffischer
Yep. This is a maven archetype that when generated, emits a multi-module skeleton project. This is similar in concept to the ecommerce.zip. This is a very bare-bones project that contains little to no GUI on the store side, but does contain all the Spring and Broadleaf config to get you started on your own customized site and admin. People who are trying to familiarize themselves with Broadleaf would likely have more success playing around with the demo, but once someone is ready to start development in earnest, then this skeleton project is a great place to start.

Here's an example of how you could generate it from the command line. The end result of what I did is a directory called myproject that contains multiple maven modules for a starter site (core, site, site-war, admin, admin-war, and test). Note - there is currently a bug in the archetype code that will prevent someone from being able to build it (it's missing a repository element). I'm likely addressing this today.

jeff-fischers-macbook-pro-2:~ jfischer$ /usr/share/maven/bin/mvn archetype:generate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> com.agilejava.docbkx:docbkx-quickstart-archetype (-)
2: remote -> com.alibaba.citrus.sample:archetype-webx-quickstart (-)
...
496: remote -> org.zkoss:zk-archetype-webapp (The ZK wepapp archetype)
497: remote -> ru.circumflex:circumflex-archetype (-)
498: remote -> se.vgregion.javg.maven.archetypes:javg-minimal-archetype (-)
499: local -> org.broadleafcommerce:ecommerce-archetype (BroadleafCommerce ECommerce Archetype)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 152: 499
Define value for property 'groupId': : com.company
Define value for property 'artifactId': : myproject
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.company: :
Confirm properties configuration:
groupId: com.company
artifactId: myproject
version: 1.0-SNAPSHOT
package: com.company
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: ecommerce-archetype:1.5.0-RC2-SNAPSHOT
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.company
[INFO] Parameter: artifactId, Value: myproject
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.company
[INFO] Parameter: packageInPathFormat, Value: com/company
[INFO] Parameter: package, Value: com.company
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.company
[INFO] Parameter: artifactId, Value: myproject
[INFO] Parent element not overwritten in /Users/jfischer/myproject/admin/pom.xml
[INFO] Parent element not overwritten in /Users/jfischer/myproject/admin-war/pom.xml
[WARNING] CP Don't override file /Users/jfischer/myproject/admin-war/pom.xml
[INFO] Parent element not overwritten in /Users/jfischer/myproject/core/pom.xml
[INFO] Parent element not overwritten in /Users/jfischer/myproject/site/pom.xml
[INFO] Parent element not overwritten in /Users/jfischer/myproject/site-war/pom.xml
[WARNING] CP Don't override file /Users/jfischer/myproject/site-war/pom.xml
[INFO] Parent element not overwritten in /Users/jfischer/myproject/test/pom.xml
[INFO] project created from Archetype in dir: /Users/jfischer/myproject
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.271s
[INFO] Finished at: Tue Dec 06 11:34:19 CST 2011
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------

Re: Using the ecommerce-archetype

Posted: Thu Apr 25, 2013 8:35 am
by aanyad
I still confused with this e-commerce archetype. Can you please explain this with more clarification?

Re: Using the ecommerce-archetype

Posted: Sun Dec 08, 2013 3:28 pm
by panopset
Looks like this doesn't work out of the box (class not found exception on an apache commons object), and hasn't been updated in a couple of years.

Is the ecommerce-archetype a reasonable place to get started once you are done with DemoSite and ready go for real?

If not, other options besides build from scratch using DemoSite as model?

+1 on aanyad's post.

Re: Using the ecommerce-archetype

Posted: Mon Dec 09, 2013 12:04 am
by phillipuniverse
No, ecommerce-archetype is definitely not a reasonable place to get started.

Currently we recommend that users start from the DemoSite and start ripping things out as you need. While you may not use any of the templates or controllers, the way we have laid out the project is at a minimum what we would recommend. We are planning on revisiting our getting started process and will definitely try to enhance the parts about starting from absolute scratch with zero scaffolding.

Re: Using the ecommerce-archetype

Posted: Mon Dec 09, 2013 9:35 am
by panopset
Thanks for the fast response. I retract my "not working out of the box" statement, turns out I had a corrupt repository :oops: , once I did clear out .m2 it compiled fine. But will go with your advise and not try to build up from the ecommerce-archetype.