Elastic Path Maven Commands
All Elastic Path Commerce modules are Maven modules with configurable pom.xml
files. The POM
files contain configuration details and dependency information required for building, installing, cleaning, packaging, and running modules in development and CI environments.
This page lists some of the commonly used Maven commands with Elastic Path Commerce.
note
When running Maven commands you may experience a java.lang.OutOfMemoryError: unable to create new native thread
error. To solve this issue increase the memory setting in the MVN_OPTS
environment variable.
Building Modules
To build a module, navigate to the module’s directory (e.g. extensions/cortex
) and execute one of these commands in the command line:
Build module and execute all integration tests
mvn clean install
Build module without running integration tests
mvn clean install -DskipAllTests
Running Webapps
To run a web application as a standalone process, navigate to the webapp module (e.g. extensions/cortex/ext-cortex-webapp
) and execute one of these commands:
Run webapp without debugging
mvn clean tomcat8:run-war
Run webapp with external debugging on port
8000
mvnDebug clean tomcat8:run-war
note
To run web applications as separate processes, the ep-developers
profile must be active. For more information see Elastic Path Maven Profiles.
The ep-developers
profile assigns the following web application ports:
8081
- Commerce Manager8082
- Search server8083
- Integration server8084
- Batch server9080
- Cortex and Cortex Studio
Running ActiveMQ
The ActiveMQ broker can either be installed as a service on your computer or run from the command line from extensions/activemq-broker
module.
Run ActiveMQ broker from command line
mvn clean tomcat8:run-war
Populating the Database
Data population commands are run from the extensions/database
module.
Delete database schema, then create and populate the database
mvn clean install -Preset-db
Update the database
mvn clean install -Pupdate-db
Updating Configuration Files
The following commands are run from the extensions/database
module to update configuration files in your local ${user.home}/ep/conf
directory. The configuration files are copied from the these locations in the extensions/database/ext-data
module.
environments/default/files/conf
which contains default configuration files that apply to all environmentsenvironments/local/files/conf
which contains configuration files that apply only to the local development environmentDuplicate files present in the default environment are overritten by those in the local environment
Delete your local
${user.home}/ep/conf
directory and copy configuration files from the default and local environmentsmvn clean install -Preset-conf
Copy configuration files to your
${user.home}/ep/conf
directory from the default and local environments, overrwriting existing filesmvn clean install -Pupdate-conf
Importing and Exporting Data Using the Import-Export Tool
For more information, see the Import-Export Tool Guide.
Import data from the target directory
mvn package -Pdo-import
Export data to the target directory
mvn clean package -Pdo-export
Testing and Code Compliance
Note that code compliance checks can also be activated using Code Compliance Profiles.
Run an individual JUnit test
mvn install -Dtest=<TestClassName>
Run an individual JUnit Integration test
mvn install -Dit=<TestClassName>
Run PMD to check for common programming flaws
mvn pmd:check
Run Checkstyle to validate code formatting and style
mvn checkstyle:check
Check for licensing compliance
mvn licensing:check
Common Build Sequences
As a development best practice, you may want to script common build sequences. Here are some examples:
Change
ep-core
logic, update theext-commerce-engine-wrapper
, then debug in Cortexmvn clean install -f commerce-engine/core/ep-core/pom.xml mvn clean install -f extensions/cortex/ext-commerce-engine-wrapper/pom.xml mvnDebug clean tomcat8:run-war -f extensions/cortex/ext-cortex-webapp/pom.xml
Change
ext-core
logic, then debug in Cortexmvn clean install -f extensions/core/ext-core/pom.xml mvnDebug clean tomcat8:run-war -f extensions/cortex/ext-cortex-webapp/pom.xml