Feature Pack 7 or later

Packaging the customization

In this lesson, you are packaging your customization to prepare it for deployment. You can package and deploy your Profit Margin tutorial related customization into your production environment with the WebSphere Commerce Build and Deployment tool.

About this task

The WebSphere Commerce Build and Deployment tool is designed to address the error-prone and time-consuming nature of customized asset deployment. The WebSphere Commerce Build and Deployment tool provides a starting point for you to automate your build and deployment processes in a standardized, controlled manner. For more information, see WebSphere Commerce Build and Deployment tool.

The following procedure provides information to help you package the Profit Margin customization that you created in this tutorial. For more information about the full process for packaging and deploying customization code if you are not familiar with using the tool, see Tutorial: Using the WebSphere Commerce Build and Deployment tool.

Procedure

Prepare the source package for both Store customization and Search customization.
  1. WebSphere Commerce package:
    1. Create the source code repository to include the Data Load utility files and code packages for your widget customization code.
      1. Copy the WCDE_installdir\wcbd folder to a temporary location, for example, under C:\
      2. Rename the directory to wcbd-deploy-server-local-profit_margin_wc.

        This directory will be referred to as the wcbd_wc directory in this task.

      3. Create the following directory structure: wcbd_wc/source/workspace.
    2. Add the Data Load utility files for your custom widget into your source code repository for the WebSphere Commerce Build and Deployment tool.
      1. Create the proper file structure under wcbd_wc/source/workspace/dataload/dataload for your Data Load utility files.
      2. Add the Data Load utility files for your custom widget into your source code repository for the WebSphere Commerce Build and Deployment tool.
        The directory should resemble the following structure in the wcbd_wc/source/workspace/dataload/dataload/common directory:
        • dataload_cost_price directory
        • dataload_price_list directory
        • wc-dataload-env.xml file
    3. Copy all of the customization folders and files to the wcbd_wc/source/workspace directory.

      That is, copy the workspace_dir\Stores directory to the wcbd_wc/source/workspace directory.

      The directory should resemble the following structure in the wcbd_wc/source/workspace directory:
      • dataload directory
      • Stores directory
  2. Search package:
    1. Create the source code repository to include the Data Load utility files and code packages for your search customization code.
      1. Copy the WCDE_installdir\wcbd folder to a temporary location, for example, under C:\
      2. Rename the directory to wcbd-deploy-server-local-profit_margin_solr.

        This directory will be referred to as the wcbd_solr directory in this task.

      3. Create the following directory structure: wcbd_solr/source/workspace.
    2. Add the Data Load utility files for your custom widget into your source code repository for the WebSphere Commerce Build and Deployment tool.
      1. Create the proper file structure under wcbd_solr/source/workspace/dataload/dataload for your Data Load utility files.
      2. Add the Data Load utility files for your custom search configuration into your source code repository for the WebSphere Commerce Build and Deployment tool.
        The directory should resemble the following structure in the wcbd_solr/source/workspace/dataload/dataload/common directory:
        • dataload_search_attr directory
        • wc-dataload-env.xml file
    3. Copy all of the customization folders and files to the wcbd_solr/source/workspace directory.

      That is, copy the workspace_dir\Search directory to the wcbd_solr/source/workspace directory, if you have customized search profiles or Search REST tags.

      The customized search profile must be defined in the wcbd_solr/workspace/Search/xml/config/com.ibm.commerce.catalog-ext/wc-search.xml file.

      The customized value mapping must be defined in the wcbd_solr/workspace/Search/xml/config/com.ibm.commerce.catalog-ext/wc-component.xml file.

      The customized Search REST tags must be defined in the wcbd_solr/workspace/Search-Rest/WebContent/WEB-INF/config/com.ibm.commerce.rest-ext/wc-rest-resourceconfig.xml file.

      The directory should resemble the following structure in the wcbd_solr/source/workspace directory:
      • Dataload directory
      • Search directory
      • Search-Rest directory
      As a result of packaging both the wcbd_wc and wcbd_solr assets, the following sample file can be used as a reference:
Prepare the automated extraction Ant scripts and configure the build setting.
Important: The following steps must be performed on both the WebSphere Commerce and Search packages. That is, for files within both the wcbd_wc and wcbd_solr directories.
  1. Set up the source extraction Ant script. The Ant script extracts the source code from the source code repository that you created.
    1. Go to the extract directory for the package you are preparing. For example, wcbd_wc/extract or wcbd_solr/extract.
    2. Copy the wcbd-sample-extract-local.properties and wcbd-sample-extract-local.xml files into the asset directory one level above it. For example, either wcbd_wc or wcbd_solr.
    3. Rename the copied wcbd-sample-extract-local.properties file to extract-local.properties.
    4. Rename the copied wcbd-sample-extract-local.xml file to extract-local.xml.
    5. Open the extract-local.xml file for editing.
    6. Locate the following line of code:
      
      <project name="wcbd-sample-extract-local" default="all">
      
    7. Replace it with the following code:
      
      <project name="extract-local" default="all">
      
    8. Save and close the file.
    9. Open the extract-local.properties file for editing.
    10. Set the value for local.extract.dir= to WCBD_installdir/source
      Note: In all of the properties files that your WebSphere Commerce Build and Deployment tool uses, you must use forward slashes in the file paths. Otherwise, the build process fails.
  2. Configure the WebSphere Commerce Build and Deployment tool build settings.
    1. Go to the Ant_installdir\lib directory.
    2. Copy the ant-contrib-1.0b3.jar file into the WCBD_installdir/lib directory.
    3. Download and extract the following file: XMLUpdate.zip.

      Copy the extracted XMLUpdate.jar file into the WCBD_installdir/lib directory.

    4. Create a copy of the wcbd-setenv.bat file and rename the copied file to setenv.bat.
    5. Create a copy of the wcbd-build.private.properties.template file and rename the copied file to build-local.private.properties.
    6. Create a copy of the wcbd-build.properties.template file and rename the copied file to build-local.properties.
    7. Open the setenv.bat file for editing.
    8. Change the value of ANT_HOME to Ant_installdir. For example, C:/apache-ant-1.8.1.
    9. Ensure that the value of WAS_HOME is correct. For example, C:/Progra~1/IBM/SDP/runtimes/base_v7.
    10. Open the build-local.properties file, under the store source package. Set the following properties:
      
      app.type=wc
      extract.ant.file=${basedir}/extract-local.xml
      web.module.list= Stores
      java.module.list= WebSphereCommerceServerExtensionsLogic
      wc.home=WCDE_installdir (e.g. C:/IBM/WCDE_ENT70)
      was.home=WAS_home (e.g. C:/Progra~1/IBM/SDP/runtimes/base_v7)
      
    11. Open the build-local.properties file, under the search source package. Set the following properties:
      
      app.type=search
      extract.ant.file=${basedir}/extract-local.xml
      web.module.list=Search-Rest
      java.module.list=SearchServerExtensionsLogic
      wc.home=WCDE_installdir (e.g. C:/IBM/WCDE_ENT70)
      was.home=WAS_home (e.g. C:/Progra~1/IBM/SDP/runtimes/base_v7)
      
  3. Obtain the deployment packages for both WebSphere Commerce and Search.
    Important: The following steps must be performed on both the WebSphere Commerce and Search packages. That is, for files within both the wcbd_wc and wcbd_solr directories.
    1. Open a command prompt and go to the WCBD_installdir directory.
    2. Run the following commands:
      For WebSphere Commerce:
      
      wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.label=profit_margin_wc -Dbuild.type=local
      
      For Search:
      
      wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.label=profit_margin_solr -Dbuild.type=local
      

      Where the value for the -Dbuild.label parameter is the name of your package. Set the value for the parameter to the value that you want to name your package. For example, the previous commands name the packages profit_margin_solr and profit_margin_wc.

      When the command runs, the WebSphere Commerce Build and Deployment tool creates two deployment packages:
      1. A package for production server deployment.
      2. A package for WebSphere Commerce Developer server deployment.

      The packages are located in the WCBD_installdir/dist and wcbd_solr/dist directories.