Skip to content

commercetools/commercetools-sunrise-java-starter

Repository files navigation

Sunrise Java Starter Project

Build Status Heroku

⚠️ The Sunrise Java Shop Framework is no longer maintained. If you would nevertheless like to use it for your own developments you should fork the framework's repository under the given license and continue developing your version, but please be aware that there will be no more updates and no support provided to this framework.

Sunrise-based project using:

Use it as a starting point to develop your own online shop project.

Preconditions

  • Install Java 8 (version >= 1.8.0_92)
  • Create a commercetools platform project with some data
  • Unless you modify the project to behave differently:
    • Product variants must contain a SKU without dashes -
    • Project must have at least a currency, country and language defined (unless you specify them via Sunrise configuration)

Deployment

For an easy and fast deployment of your application, we recommend Heroku:

Deploy

This will take you to the configuration page to create a Sunrise application in Heroku. Once you have created it, you can access and modify the source code of your application via Git, as explained in Git Cloning Existing Heroku Applications.

If Heroku reports that you have cloned an empty repository execute the following commands:

cd <project-folder>
git remote add origin https://github.com/commercetools/commercetools-sunrise-java-starter.git
git pull origin master

(Source)

Run it locally

First, clone this repository onto your local machine. Next, create a new file named dev.conf inside the conf folder and insert the credentials of your commercetools platform project as follows:

sunrise.ctp.client {
  projectKey = your-project-key
  clientId = your-client-id
  clientSecret = your-client-secret
  authUrl = "https://auth.sphere.io"
  apiUrl = "https://api.sphere.io"
}

If you have SBT on your computer, you can run it with sbt ~run. Otherwise you can use the Activator found in the project to run it locally:

  • on Linux/Mac: ./activator ~run
  • on Windows: activator ~run

In any case, the output will be similar to:

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)

Now open http://localhost:9000 in your browser and you should be able to access the web application using your project.