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.
- Your Command Line's directory is set to the Elastic Path source code home.
- Your developer environment is set up according to these instructions: Setting up your Developer Environment
Building the Applications
Cortex APImvn -f cortex\pom.xml install -Pwith-oauth2-resourceCortex 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+DocumentationMake 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.
This starts up Cortex API in http on port 9080
To run a web application:
- In the Command Line, navigate to the project directory of the web application you wish to run.
- 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>
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
If you want to remove previous build artifacts before rebuilding, use mvn clean install instead.