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

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

3. Importing Source Code into Eclipse

3. Importing Source Code into Eclipse

Importing the Commerce Engine

  1. In Eclipse's file menu, select Project and disable Build Automatically.
  2. Choose File -> Import.
  3. Select Maven -> Existing Maven Projects and click Next.
  4. Click Browse... and set the root directory to the folder containing the Elastic Path Commerce Engine.
  5. Click Select All to select all projects.
    Note:

    We recommend only opening the projects you are intending to work on. In some cases, Eclipse memory issues occur when all the projects are open at the same time.

  6. Click Finish and wait for the import to complete.
  7. Select Project -> Clean...
  8. Select Clean all projects, and unselect Start a build immediately.

    Eclipse Clean.png

  9. Click OK.
  10. Choose Project -> Build All to build your Elastic Path projects in Eclipse.
    Note:

    Eclipse may run out of memory during the build process. If this occurs, restart Eclipse and run Build All again.

Importing the Commerce Manager Client

  1. In Eclipse, select Project and disable Build Automatically.
  2. Choose File -> Import.
  3. Select Maven -> Existing Maven Projects and click Next.
  4. Click Browse..., set the root directory to <Source Code root>\cmclient\target-platform, and click OK.
  5. Click Finish and then wait for the import to complete before continuing.
    Warning:

    You must wait for all the CM Client projects to import before continuing; otherwise, Eclipse will run into synchronization issues.

  6. In the target-platform project, open cmclient-e45.target, and wait for Eclipse to resolve the Target Definitions before continuing.
    Warning:

    You must wait for Eclipse to resolve the Target Definitions; otherwise, Eclipse will run into synchronization issues.

  7. Click Set as Target Platform, located at the top-right section of the Target Definitions screen.
    Warning:

    You must wait for Eclipse to resolve the Target Platform this may take some time.

  8. Choose File -> Import.
  9. Select Maven -> Existing Maven Projects and click Next.
  10. Click Browse... and set the root directory to <Source Code root>\cmclient
  11. Click Select All to select all projects.
  12. Click Finish and wait for the import to complete.
  13. Choose File -> Import.
  14. Select Maven -> Existing Maven Projects and click Next.
  15. Click Browse... and set the root directory to <Source Code root>\commerce-engine\core
  16. Click the check marks on the following project:
    1. ep-base\pom.xml
    2. ep-cache\pom.xml
    3. ep-persistence-api\pom.xml
    4. ep-persistence-openjpa\pom.xml
    5. ep-core\pom.xml
    6. ep-money\pom.xml
    7. ep-settings\pom.xml
  17. Click Finish and wait for the import to complete.
  18. Choose File -> Import.
  19. Select Maven -> Existing Maven Projects and click Next.
  20. Click Browse... and set the root directory to <Source Code root>\extensions\osgi-wrappers
  21. Right click on all the packages in the Package Explorer.
  22. Click Select All to select all projects.
  23. Click Finish and wait for the import to complete.
  24. Click Properties from the popup menu.
  25. Click Java Compiler and ensure that the compliance version is 1.8.
  26. Select Project -> Clean...
  27. Select Clean all projects, and unselect Start a build immediately.
  28. Click OK.
  29. Choose Project -> Build All to build the Commerce Manager Client projects in Eclipse
    Note:

    Eclipse may run out of memory during the build process. If this occurs, restart Eclipse and run Build All again.

Note:

We recommend creating Working Sets in Eclipse to organize your Core and Commerce Manager client projects.

Tip: If Eclipse Continually Hangs During Build All

If Eclipse continually hangs when building all your projects at the same item, you may want to build your projects separately to reduce the load on the CPU. In Eclipse, disable Build Automatically and build the projects in this order:

  1. core*
  2. ep-common-web*
  3. ep-test*
  4. ep-querylanguage*
  5. ep-search*
  6. ep-cmserver*
  7. ep-storefront*
  8. ep-cmserver*
  9. ep-elasticpath-cmclient*

Then switch on Build Automatically to build the remaining projects.

Importing an extension project

The steps below are for importing any extension project build with an Elastic Path archetype, i.e. storefront

  1. In Eclipse, open your Elastic Path workspace, choose File -> Import -> Existing Maven Projects into Workspace, and click Next.
  2. Next to Select root directory, click Browse and select the extension project directory.
  3. Make sure the project is selected in the list of projects and click Finish.
    Note: Enhancing the Core

    If you are importing a Core extension, you will likely see the following error dialog:

    EnhanceError.png

    Click OK to get rid of the error messages. We will resolve this in step 6.

  4. Right-click your project in Eclipse and choose Properties.
  5. Click Maven and make sure Resolve dependencies from Workspace projects is enabled.
  6. Click OK.
    Note:

    If you are importing a Core extension, follow these steps in Enhancing core library extension classes.

  7. Right-click the project in the Eclipse Project Explorer and choose Run As -> Maven package. This will run the mvn package command for your extension.
    Note:

    If you need to add dependencies to your extension project, add them via the POM file. You can do this using the Eclipse Maven plugin. Right-click the project and choose Maven -> Open POM. Then use click the Dependencies tab.

  8. Go to Project -> Clean...
  9. Select Clean all projects, and unselect Start a build immediately.
  10. Click OK.
  11. Go to Project -> Build All and wait for your project to finish building.
Note:

Eclipse may run out of memory during the build process. If this occurs, restart Eclipse and run Build All again.