Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Prepare Source Code

Prepare Source Code

Note: Role: Tech Lead
Dependent on By Documentation
Source control provisioning IT Operations Prepare Infrastructure
Maven repository setup Dev Ops Setup Maven Repository

Overview

This page describes how to prepare Elastic Path source code for use by your project. The diagram below shows the steps.

Note:

ep-aem-commerce and geometrixx-demo projects are only available with EP-Commerce-for-AMC-1.5.zip package

Starting Construction Prepare Source

Setup local build environment

You will need a working Java build environment on your local computer to prepare the source code.

  1. Setup your build environment as described in the following sections of the Core Commerce 6.17.0 Developer Guide:
    1. Java 8 (JDK 1.8 64-bit) setup
    2. Maven 3.3.9 setup
    3. Configure your System Environment Variables

Unzip source release packages

EP source is delivered in multiple ZIP files. You should obtain one or more of the following release packages depending on your license and the environment you wish to create:

Release Package Contents
EP-Commerce-6.17.0.zip Core Commerce, Cortex
EP-Commerce-for-AMC-1.5.zip EP Commerce for Adobe Marketing Cloud
  • Unzip the contents of the release packages into your project source folder.
    Warning: Windows File Path Limitation

    Do not save your source projects to a directory that is greater than 20 characters in length. Windows file paths are limited to 260 characters. The longest file path in the source code is greater than 230 characters so be careful where you deploy your source files.

Add projects to source control

  1. The following projects should be added to source control:
    • Elastic Path Commerce: cmclient, commerce-engine, cortex-ep-integration, devops and extensions. (Note: the commerce-data project is included in the release package for reference and doesn't need to be added to source control.)
    • Elastic Path Commerce for AMC: ep-aem-commerce and geometrixx-demo.
    Tip:

    Previously the common practice had been to add each project to source control as a separate repository. Recently, a number of project teams have found it to be more effective to have all projects in a single repository as this simplifies commits and builds across multiple projects.

    The rational for using multiple repositories was that different upgrade strategies were needed for different projects. A newer upgrade strategy has emerged that works with a single repository and is being adopted as a standard practice.

    Tip:

    If you are using Git, line endings need to be converted to LF on input.

    The command to configure this is:
    git config --global core.autocrlf input
  2. Create a development branch for each repository. The branch name depends on your SCM and branch naming conventions.

Configure the project settings.xml

The extensions project you just added to source control has a maven/settings.xml the project teams will use.

  1. Replace the <mirror> <url> at the the top of the file with the <Project> EP Repository Group URL documented during Setup Maven Repository.
  2. Make any changes required for your project environment.
  3. Commit the changes to source control.
  4. Copy the settings.xml to your ${user.home}/.m2 directory.

Remove unlicensed modules

If you do not have a license for EP Commerce for AMC, you need to remove related dependencies from the extensions project source. Otherwise the build will fail when it attempts to get artifacts from Elastic Path Maven repository groups to which you don't have access.

The devops project: contains modules to remove EP Commerce for AMC references from the extensions project source:

Removing EP Commerce for AMC from project source

To remove EP Commerce for AMC references from the extensions project:

cd devops/scripts/remove-ep-for-aem-reference
mvn package -Dextensions.dir=<file_path_to_extensions_directory>

Reversion Projects for Development

EP release packages contain projects with RELEASE versions. Prior to starting development, the projects must be reversioned to SNAPSHOT versions using scripts provided in the devops project.

Tip:

On Windows, use either Git Bash, MinGW, or Cygwin to run the script.

To reversion projects for development:

  1. Make sure that:
    • All projects have a common parent folder.
    • Project folders have the same names as ones provided in source release packages.
    • The development branch is checked out for each source repository.
  2. Run the following script to reversion the cmclient, commerce-engine, devops and extensions projects.
    cd <projects-parent-folder>
    ./devops/scripts/set-ep-versions.sh 617.0.0-SNAPSHOT 0-SNAPSHOT commerce-engine extensions cmclient devops
    
  3. (Optional) Run the following script to reversion the cortex-ep-integration project. If you don't reversion this project, then the cortex-ep-integration release binaries will be retrived from the Elastic Path Nexus repository. You will need to reversion the project to a SNAPSHOT version if you wish to make changes to it.
    cd <projects-parent-folder>
    ./devops/scripts/set-cortex-ep-integration-version.sh 617.0.0-SNAPSHOT 0-SNAPSHOT cortex-ep-integration extensions
    
  4. (Optional) Run the following script to reversion the EP Commerce for AMC projects.
    cd <projects-parent-folder>
    ./devops/scripts/set-ep-for-aem-versions.sh 617.0.0-SNAPSHOT 0-SNAPSHOT ep-aem-commerce geometrixx-demo

Deliverables

  • All EP projects added to source control
  • Projects have development branches with SNAPSHOT versions
  • extensions/maven/settings.xml is configured correctly for local development