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

Cortex API Maven Commands

Cortex API Maven Commands

Cortex API projects are Maven projects with a pom.xmlfile. POM.xml files contain configuration details and dependency information required for building, installing, cleaning, packaging, and running each of the Elastic Path Maven projects.

This page lists a few of the commonly used Maven commands with Elastic Path.

For more in-depth information on Maven commands, refer to the guides on Maven's build cycle and plugins.
Note: Document Assumptions

Building the Applications

Cortex API
mvn -f cortex\pom.xml install -Pwith-oauth2-resource
Cortex Studio
mvn -f studio\pom.xml install

Running Web Applications in Tomcat

Cortex API requires a running Search Sever and ActiveMQ-broker. Search is required for Cortex API's search capabilities and ActiveMQ-broker is required to submit an order complete message when finalizing purchases. For more information on these web applications, see the Commerce Engine Developer Guide: https://docs.elasticpath.com/display/EP/Elastic+Path+Documentation
Note: wtp-developer profile note

Make sure your <wtp-developer> profile in your .m2\settings.xml is commented out. For more information on the wtp-developer profiles, see Elastic Path Maven Profiles.

Warning: Port Startup Warning

This starts up Cortex API in http on port 9080

Elastic Path 1.9.0 provides Tomcat users the ability to run individual web applications using Maven.

To run a web application:

  1. In the Command Line, navigate to the project directory of the web application you wish to run.
  2. Run the following Maven command to start Tomcat:
    mvn tomcat:run-war

To build and run Checkstyle, JUnit unit and integration tests, and third party license checks:

mvn install

To build Checkstyle, JUnit unit and integration tests, third party license checks, and PMD:

mvn install -Dcheckin

To skip running the tests (this still builds the projects)

mvn install -DskipAllTests

Run testing tasks for each projects independently. From the root directory of the project:

  • To run PMD (To check for good coding practices):
    mvn pmd:check
  • To run Checkstyle (To check your code for formatting and style)
    mvn checkstyle:check
  • To run third party license checks:
    mvn licensing:check
  • To run an individual JUnit test:
    mvn install -Dtest=<test_class_name>
  • To run an individual JUnit integration test:
    mvn install -Dit=<test_class_name>
Note: Eclipse Integration

Normally you don't need to run PMD and Checkstyle if PMD and Checkstyle are set up correctly in Eclipse as the plugins can report the same warnings and errors in Eclipse. In addition, you can run JUnit tests from within Eclipse by selecting a Test class and choosing "Run as... JUnit Test".

Cleaning Projects

Sometimes, the source code and binaries in a project may get out of sync. For example, old versions of libraries that are no longer used still exist and cause conflicts with newer versions. Use the clean targets to remove old, unused binaries from the project.

To clean all Elastic Path projects, go to the root Elastic Path directory and run:

mvn clean

To clean a single project, execute the following:

mvn -f <path-to-project>\pom.xml clean

Maven can build your web application into .WAR files for deployment on Tomcat, Oracle WebLogic, and WebSphere.

In the command line, change to your Web Application directory and execute one of the following commands:

For deployment on Apache Tomcat 6 and Tomcat 7:

mvn install -Pwith-tomcat-war

For deployment on WebLogic:

mvn install -Pwith-weblogic-war
Tip: Remove Build Artifacts Tip

If you want to remove previous build artifacts before rebuilding, use mvn clean install instead.