In this lesson, you package your customization to prepare it for deployment. You can
package and deploy your profit margin related customization files 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 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.
Important: The package and deployment process replaces files on the deployment target
server. Ensure that no previous customization will be removed or replaced by the customization
changes that you made in this tutorial.
Procedure
Prepare the source package for both the WebSphere Commerce EAR
customization and WebSphere Commerce search EAR customization.
-
WebSphere Commerce EAR package:
-
Create the source code repository to include the Data Load utility files and code packages for
your updated product recommendation widget customization code.
- Copy the WCDE_installdir\wcbd folder to a temporary
location, such as under C:\.
- Rename the directory to be
wcbd-deploy-server-local-profit_margin_wc.
This directory is 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, which load customized data on the server side, into your
source code repository for the WebSphere Commerce Build and Deployment tool.
- Create the file structure
wcbd_wc/source/workspace/dataload/dataload/common for your
Data Load utility files.
- Add the Data Load utility files for your custom widget into your source code repository for the
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
The dataload_cost_price and dataload_price_list must
include the price list and cost price data that you previously loaded. For more information about
creating the wc-dataload-env.xml file, see Configuring the data load environment settings. The environment settings in this
file must match the environment settings for your target environment where you are deploying your
customization.
-
Copy all of the customization folders and files to the
wcbd_wc/source/workspace directory.
- Create the directory structure:
wcbd_wc/source/workspace/Stores
- Copy the following files from the workspace_dir\Stores
directory to the wcbd_wc/source/workspace/Stores directory.
- WebContent/widgetdir/com.ibm.commerce.store.widgets.CatalogEntryRecommendation/CatalogEntryRecommendation_Data.jspf
- WebContent/widgetdir/Common/PriceDisplay/PriceDisplay_Data.jspf
- WebContent/widgetdir/Common/PriceDisplay/PriceDisplay_UI.jspf
The directory should resemble the following structure in the
wcbd_wc/source/workspace directory:
- dataload directory
- Stores directory
The contents of your packaged
wcbd_wc assets can resemble the
contents of the following sample file.
-
WebSphere Commerce 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 is 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 which load customized data on the server side into your source
code repository for the WebSphere Commerce Build and Deployment tool.
- Create the file structure under
wcbd_solr/source/workspace/dataload/dataload/common 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.
- Create the file structure:
wcbd_solr/source/workspace
- Copy the following files from the workspace_dir\Search
directory to the wcbd_solr/source/workspace directory:
- Search/xml/config/com.ibm.commerce.catalog-ext/wc-search.xml
- Search/xml/config/com.ibm.commerce.catalog-ext/wc-component.xml
- Create the file structure: wcbd_solr/source/workspace/Search-Rest
- Copy the following file from the
workspace_dir\Search-Rest directory to the the
wcbd_solr/source/workspace/Search-Rest directory:
- WebContent/WEB-INF/config/com.ibm.commerce.rest-ext/wc-rest-resourceconfig.xml
The directory should resemble the following structure in the
wcbd_solr/source/workspace directory:
- Dataload directory
- Search directory
- Search-Rest directory
The contents of your packaged
wcbd_solr assets can resemble the
contents of the following sample file.
Prepare the automated extraction Ant scripts and configure the build
setting.Important: Steps 3-5 must be performed on both the
wcbd_wc and wcbd_solr packages. In these steps,
wcbd_wc is used as the example. You need to repeat the same steps for
wcbd_solr directory.
-
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.
-
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.
-
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.
-
Rename the copied wcbd-sample-extract-local.properties file to
extract-local.properties.
-
Open the extract-local.properties file for editing.
-
Set the value for
local.extract.dir=
to
wcdb_wc/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-build.private.properties.template file and
rename the copied file to build-local.private.properties.
-
Create a copy of the wcbd-setenv.bat file and rename the copied file to
setenv.bat.
-
Open the setenv.bat file for editing.
-
Change the value of ANT_HOME to Ant_installdir.
For example, C:/apache-ant-1.9.2.
-
Ensure that the value of WAS_HOME is correct.
-
Create a copy of the wcbd-build.properties.template file and rename the
copied file to build-local.properties.
-
Open the build-local.properties file, under the WebSphere Commerce EAR
source package. Set the following properties:
app.type=wc
extract.ant.file=${basedir}/extract-local.xml
web.module.list= Stores
wc.home=WCDE_installdir
was.home=WAS_home
Note: For the
build-local.properties in the
wcbd_solr
directory, set the following
properties
app.type=search
extract.ant.file=${basedir}/extract-local.xml
web.module.list=Search-Rest
wc.home=WCDE_installdir
was.home=WAS_home
-
Obtain the deployment packages for both the WebSphere Commerce EAR and WebSphere Commerce search EAR.
-
Open a command prompt and go to the wcbd_wc directory.
-
Run the following command:
wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.label=profit_margin_wc -Dbuild.type=local
Note: For
the
wcbd_solr package, run the following command
instead:
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 Build and Deployment tool creates two deployment packages:
- A package for production server deployment.
- A package for IBM WebSphere Commerce Developer server deployment.
The packages are in the
WCBD_installdir/dist and
wcbd_solr/dist directories. The packages for deploying the
customization in a production environment resemble the following sample packages:
Download and extract these packages to a temporary directory in your target deployment
environment for reference.
-
For the WebSphere Commerce search EAR package, copy the customization related files that
are outside of the workspace_dir directory.
Note: This step is required for the search package only. As a limitation of the Build and
Deployment tool, files outside of workspace_dir directory
cannot be compiled and packed. Therefore, you must manually copy any files that are not in that
directory and include the copied files into your deployment package.
-
In a file manager utility, go to the wcbd_solr/dist/server
directory.
-
Extract the wcbd-deploy-server-local-profit_margin_solr.zip compressed
file.
-
Within the extracted file structure, browse to the
wcbd-deploy-server-local-profit_margin_solr/source
directory. If your target deployment environment is another development environment, go to the
wcbd_solr/dist/toolkit directory instead.
-
Create a folder and name the folder SearchConfig.
-
Copy the following files from the
Solrhome\MC_masterCatalogId\locale\CatalogEntry\conf
directory into your newSearchConfig directory:
- solrcore.properties
- x-data-config.xml
- x-schema.xml
-
Package the extracted wcbd-deploy-server-local-profit_margin_solr directory
that now includes the SearchConfg directory and files into a new
wcbd-deploy-server-local-profit_margin_solr.zip compressed file.