Setting up Developer Environment
Configuring Environment Variables
Use this procedure to set system environment variables for:
- Java:
JAVA_HOME
andJAVA_OPTS
- Maven:
MAVEN_HOME
andMAVEN_OPTS
- MySQL:
MYSQL_HOME
Windows
Open the Start menu, right-click My Computer and select Properties.
Click Advanced System Settings.
To quickly show the System Properties > Advanced > Environment Variables from the Windows Run prompt, type
SystemPropertiesAdvanced
and press Enter.In the System Properties > Advanced, click Environment Variables.
To add a new system environment variable, on the Environment Variables window, click New.
Add the following:
JAVA_HOME
:C:\Program Files\Zulu\zulu-8-amd64
JAVA_OPTS
:-Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true
MAVEN_HOME
:C:\apache-maven-3.6.2
MAVEN_OPTS
:-Xmx2548m -XX:ReservedCodeCacheSize=128m -Dsun.lang.ClassLoader.allowArraySyntax=true
MYSQL_HOME
:C:\MySQL\MySQL Server 5.7
The values for
JAVA_HOME
,MAVEN_HOME
, andMYSQL_HOME
variables depend on the location where Java, Maven, and MySQL are installed. This location might differ from the default values provided.Select the
Path
system variable, and click Edit.Add the following variables at the end of the
Path
variable:;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%MYSQL_HOME%\bin;
Mac and Linux
Modify your
~\.bash_profile
(if using Bash shell) or~\.zshrc
(if using zsh shell) in your home folder to set the required environment variables.export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0") export JAVA_OPTS="-Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true" export MAVEN_HOME=/home/USERNAME/tools/apache-maven-3.6.2 export MAVEN_OPTS="-Xmx2548m -XX:ReservedCodeCacheSize=128m -Dsun.lang.ClassLoader.allowArraySyntax=true" export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
Open a new terminal window and verify the installation as follows:
$ java -version openjdk version "1.8.0_275" OpenJDK Runtime Environment (Zulu 8.50.0.51-CA-macosx) (build 1.8.0_275-b01) OpenJDK 64-Bit Server VM (Zulu 8.50.0.51-CA-macosx) (build 25.275-b01, mixed mode) $ mvn -version Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T08:06:16-07:00) Maven home: /Users/gdenning/apache-maven-3.6.2 Java version: 1.8.0_275, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre Default locale: en_CA, platform encoding: UTF-8 OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
Building Source Code
Checkout Source Code
Windows File Path Limitation
Do not save your source project to a directory if the file path is greater than 20
characters. Windows file paths are limited to 260
characters. The longest file path in the source code is greater than 230
characters.
To checkout a local copy of the Elastic Path source code from your source control repository:
- Create a folder to save the Elastic Path source.
- Checkout the Elastic Path Commerce code from the source control repository to your local source folder.
settings.xml
Configure Maven Before you build the source code, create a local Maven directory and update the settings.xml
file.
Create an
.m2
directory in your local user directory. Example:> mkdir C:\Users\<YourWindowsUser>\.m2
Copy the
settings.xml
file from the branch location../extensions/maven
to your local directory.m2
.Edit the following values in the
settings.xml
file to match your local developer environment.Setting Description epdb.reset_user
Maven Profile: mysql-dev-db
. The database account with administrative permissions that can drop and create databases and users in your local database.epdb.reset_password
Maven Profile: mysql-dev-db
. The password forepdb.reset_user
.ep.local.asset.path
The path to your local /extensions/assets/ext-assets/src/main/assets
source directory.ep.smtp.host
Your SMTP Server. internet-mirror
The URL of your organization’s Nexus server. Verify that the URL is already set. If not, contact the person who set up the team environment. For more information, see Configure the Maven Settings for the Team. warning
If these property values do not exist in the
settings.xml
file, the source code might not be following the guidelines at Setup Guide, and you cannot build and deploy the Elastic Path Web Applications.
Build All Projects
You can build all projects with one Maven command.
Open the command line and navigate to the Elastic Path Commerce source directory.
Run the following Maven command:
mvn clean install -DskipAllTests
With the
-DskipAllTests
command, the system does not run any unit test or integration tests, however the system still builds the test. For more details on the Maven arguments, see Elastic Path Maven Commands.
Build Individual Modules
You can also build each module in Elastic Path separately, if required. However, you cannot build the individual modules unless you build the Elastic Path Commerce source directory at least once. When you build the Elastic Path Commerce modules separately, you must follow the following order:
commerce-data
commerce-engine
health-monitoring
commerce-manager
cortex-resources
extensions
For example, when you build the commerce-manager
module, you must first build the commerce-data
and commerce-engine
modules separately.
To build a modules individually, in the command line, navigate to the Elastic Path Commerce source directory.
Navigate to the project/module that you want to build.
Enter the following Maven command:
mvn clean install -DskipAllTests
With the
-DskipAllTests
command, the system does not run any unit test or integration tests, however the system still builds the test. For more details on the Maven arguments, see Elastic Path Maven Commands
Local MySQL Configuration
To ensure that your local MySQL configuration is correct, ensure that it meets the following requirements:
- MySQL runs in the
READ_COMMITTED
isolation level. - MySQL server time zone is set to UTC.
If these settings are not set, you will receive an error message similar to the following examples:
Isolation level error:
The database transaction isolation must be `READ_COMMITTED` but it is `REPEATABLE_READ`.
MySQL server time zone error:
The server time zone value `PDT` is unrecognized or represents more than one time zone.
note
These steps are for only for users with a Mac operating system.
To update these settings, use the following steps:
Check if you have a file named
/etc/mysql/my.cnf
. If you do not, run the following commands in your terminal:cd /etc sudo mkdir mysql sudo chown mysql:mysql mysql cd mysql sudo touch my.cnf sudo chown mysql:mysql my.cnf
In the
/etc/mysql/my.cnf
file, populate the file with the following code using a text editor:[mysqld] transaction_isolation=READ-COMMITTED default-time-zone="+00:00"
Restart MySQL with the following command:
sudo /usr/local/mysql/support-files/mysql.server restart