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.
- WebSphere Commerce package:
- Create the source code repository to include the Data
Load utility files and code packages for your widget customization
code.
- Copy the WCDE_installdir\wcbd folder
to a temporary location, for example, under C:\
- 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.
- Create the following directory structure: wcbd_wc/source/workspace.
- Add the Data Load utility files for your custom widget
into your source code repository for the WebSphere Commerce Build
and Deployment tool.
- Create the proper file structure under wcbd_wc/source/workspace/dataload/dataload for
your Data Load utility files.
- 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
- 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
- Search package:
- Create the source code repository to include the Data
Load utility files and code packages for your search customization
code.
- Copy the WCDE_installdir\wcbd folder
to a temporary location, for example, under C:\
- 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.
- Create the following directory structure: wcbd_solr/source/workspace.
- Add the Data Load utility files for your custom widget
into your source code repository for the WebSphere Commerce Build
and Deployment tool.
- Create the proper file structure under wcbd_solr/source/workspace/dataload/dataload for
your Data Load utility files.
- 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
- 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.
- Set up the source extraction Ant script. The Ant script
extracts the source code from the source code repository that you
created.
- Go to the extract directory for
the package you are preparing. For example, wcbd_wc/extract or wcbd_solr/extract.
- 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.
- Rename the copied wcbd-sample-extract-local.properties file
to extract-local.properties.
- Rename the copied wcbd-sample-extract-local.xml file
to extract-local.xml.
- Open the extract-local.xml file
for editing.
- Locate the following line of code:
<project name="wcbd-sample-extract-local" default="all">
- Replace it with the following code:
<project name="extract-local" default="all">
- Save and close the file.
- Open the extract-local.properties file
for editing.
- 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.
- Configure the WebSphere Commerce Build and Deployment tool
build settings.
- Go to the Ant_installdir\lib directory.
- Copy the ant-contrib-1.0b3.jar file
into the WCBD_installdir/lib directory.
- Download and extract the following file: XMLUpdate.zip.
Copy
the extracted XMLUpdate.jar file into the WCBD_installdir/lib directory.
- Create a copy of the wcbd-setenv.bat file
and rename the copied file to setenv.bat.
- Create a copy of the wcbd-build.private.properties.template file
and rename the copied file to build-local.private.properties.
- Create a copy of the wcbd-build.properties.template file
and rename the copied file to build-local.properties.
- Open the setenv.bat file for editing.
- Change the value of ANT_HOME to Ant_installdir.
For example, C:/apache-ant-1.8.1.
- Ensure that the value of WAS_HOME is
correct. For example, C:/Progra~1/IBM/SDP/runtimes/base_v7.
- 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)
- 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)
- 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.
- Open a command prompt and go to the WCBD_installdir directory.
- 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:
- A package for production server deployment.
- A package for WebSphere Commerce Developer server deployment.
The packages are located in the WCBD_installdir/dist and wcbd_solr/dist directories.