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.5.2
MAVEN_OPTS
:-Xmx2048m -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;
Linux
To set the system variables on Linux, modify your .bash_profile
in your home folder as shown in this example.
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
JAVA_HOME=/home/USERNAME/tools/zulu-8-amd64/
export JAVA_HOME
JAVA_OPTS='-Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true'
export JAVA_OPTS
MAVEN_HOME=/home/USERNAME/tools/apache-maven-3.5.2
export MAVEN_HOME
MAVEN_OPTS='-Xmx2048m -XX:ReservedCodeCacheSize=128m -Dsun.lang.ClassLoader.allowArraySyntax=true'
export MAVEN_OPTS
PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
export PATH
MacOS
For Macintosh OS X development environments with multiple Java versions installed, set JAVA_HOME
to use the Zulu OpenJDK Java 8u202
using the following commands:
Example location of a non-Zulu Java JDK(Java Development Kit): /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
# List all Java installations:
$ /usr/libexec/java_home -V
11.0.1, x86_64: "Java SE 11.0.1" /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
1.8.0_202-zulu-8.36.0.1, x86_64: "Zulu 8" /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
# Set JAVA_HOME to the Zulu OpenJDK to 1.8.0u202 installation:
$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_202-zulu-8.36.0.1`
# Check and verify
$ java -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-macosx) (build 1.8.0_202-b05)
OpenJDK 64-Bit Server VM (Zulu 8.36.0.1-CA-macosx) (build 25.202-b05, mixed mode)
# Confirm JAVA_HOME is now set to Zulu OpenJDK 1.8.0u202:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
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