Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 59 lines (43 sloc) 1.74 KB

Simple example integrating the commercetools JVM SDK with Spring MVC and Spring DI

screen shot 2015-12-02 at 10 18 06

Create a project

requirements:

mvn archetype:generate \
  -DarchetypeGroupId=com.commercetools.maven-archetypes \
  -DarchetypeArtifactId=commercetools-spring-mvc-quickstart \
  -DarchetypeVersion=0.4.0 \
  -DgroupId=io.sphere.demo \
  -DartifactId=commercetools-spring-mvc \
  -Dversion=0.1.0-SNAPSHOT \
  -DcommercetoolsProjectKey=YOUR-PROJECT-KEY \
  -DcommercetoolsClientId=YOUR-CLIENT-ID \
  -DcommercetoolsClientSecret=YOUR-CLIENT-SECRET

Change to the project folder

cd commercetools-spring-mvc

Run the project

mvn tomcat7:run

Test on the browser

http://localhost:8080/

Creating a new project in Eclipse

  • Import archetype URI by Import ... > Projects from Git > Clone URI
  • Install the archetype in local repository with mvn install
  • Go to Preferences > Maven > Archetypes and Add Local Catalog
  • Select the catalog from file (archetype-catalog.xml)
  • Create new Maven project and select the archetype (remember so select Include snapshot archetypes)

If you have any troubles with installation in Eclipse, you may want to have a look at this issue: #74

Credits

This template is a modified copy of https://github.com/kolorobot/spring-mvc-quickstart-archetype