Administer > Deploy > Deploying customized assets > Customized WebSphere Commerce Enterprise Application (EAR) assets > Package custom Java EE assets
Package J2EE assets for a partial application
Before you deploy the partial application, package it in a format that WebSphere Application Server understands. In a partial application update, many single file assets are combined into a ZIP file in a structure that matches the final deployment. Depending on the type of files, we will take a different approach to packaging the assets for deployment. The result of this package is a ZIP file of all the changed assets packaged for deployment.
Package for a partial application involves three stages:
- Create a directory to contain all of the assets.
This directory represents the root of the EAR
- Collect all of the assets to deploy and place them underneath this directory.
The structure underneath this directory must match the structure you want in the J2EE application to which we will be deploying. The assets can be any combination of the following:
- JAR files that contain controller commands, data beans, or Java code
- Store assets
- Assets stored outside of the WebSphere Commerce development environment workspace, such as those in the /xml or /properties directories
- Package all assets as a single ZIP file.
All .xmi files must not be included when packaging J2EE assets for a partial application.
The following is more details on each stage. In the examples, /ExportTemp/partialApp is used as the directory to collect the partial application assets. Use any directory name you like.
Procedure
- Collect controller commands, data beans, or Java code
If you are deploying controller commands, data beans, or Java code:
- Export and package the files as a JAR file. You cannot deploy custom commands, data beans, and Java code unless the files are first packaged into a JAR file.
- Place the JAR file in the directory that we will be using to build the deployment package. For example, /ExportTemp/partialApp. This directory represents the root of the target EAR file. Underneath this directory, the file must be in the correct path as it would be in the EAR.
- Collect store assets
If you are deploying store assets JSP files, HTML files, images, property files, and other store assets), export the file from the WebSphere Commerce development environment:
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Right-click the Stores folder > Export > Export.
- In the Export wizard:
- Select File system and click Next.
- Select all of the resources that to deploy; that is, select all of the JSP files, HTML files, images, property files, and other store assets that need to be deployed.
- Select Create directory structure for files.
- In the Directory field, enter a temporary directory into which these resources will be placed. For example, enter...
/ExportTemp/partialApp
- Click Finish.
- On the file system, make the following changes:
- Rename the Stores directory to Stores.war.
- Move the contents of the WebContent directory up into the Stores.war directory. For example, move this directory and file:
Stores.war\WebContent\ ConsumerDirect_name\MyNewJSPTemplate.jsp...into...
Stores.war\ConsumerDirect_name\MyNewJSPTemplate.jsp
- Delete the now empty WebContent directory.
- Ensure the name of the store directory, for example, ConsumerDirect, matches the name of the store on the target machine.
- Collect assets stored outside of the WebSphere Commerce development environment workspace
In WebSphere Commerce Developer, all store-related assets are stored in the Stores Web module and any Java or EJB assets are stored in the Rational Application Developer Workspace. Some assets are not stored in the workspace at all. For instance, XML configuration files and properties files are not stored inside the workspace; these files are used for customizing the tools framework. The following table illustrates the location in WebSphere Commerce Developer and the corresponding location inside the WebSphere Commerce Enterprise Application:
Development environment path EAR path workspace_dir/wc/xml/ xml/ workspace_dir/wc/properties/ properties/
If you have customized a file in these directories, copy these assets to the directory you are using to build the deployment package. The structure under this directory must match the structure that you want inside the EAR, as indicated in the preceding table. For example, if you customized...
workspace_dir/wc/xml/messaging/user_template.xml...deploy it as...
xml/messaging/user_template.xml
Deleting assets from the EAR and including META-INF/ibm-partialapp-delete.props in the ZIP fileUse either the WebSphere Application Server administrative console to add or update assets. However, deleting application files in a partial application update deployment scenario is accomplished by supplying a special metadata file called...
META-INF/ibm-partialapp-delete.props...in the partial application ZIP. This file can exist at the application scope or at any embedded archive scope including modules.
For example, to delete files at the application level (outside of any module) add a file...
/META-INF/ibm-partialapp-delete.props...in the partial application ZIP file. Similarly, to delete files from a module (for example, MyWeb.war), add a file...
/MyWeb.war/META-INF/ibm-partialapp-delete.props...in the partial application ZIP file.
To delete files from util.jar inside MyWeb.war, add a file... '
/MyWeb.war/util.jar/META-INF/ibm-partialapp-delete.propsTo delete assets first create and include the metadata file called...
META-INF/ibm-partialapp-delete.props...in the partial application ZIP:
- Identify the files and the modules containing the files that to delete.
- Create a temporary directory on the file system for the assets to delete, for example...
/exportTemp/partialApp
- For any EAR level files to delete:
- Create a file called...
META-INF/ibm-partialapp-delete.props
- For each file to delete, add a line to that file giving the relative path to the file, including the file name. For example, to delete...
WC_demo.ear/mydir/myfile.txt...put...
mydir/myfile.txt...in the file on a line by itself.
- For each module that contains files to delete:
- Create a file called module/META-INF/ibm-partialapp-delete.props
- For each file to delete from that module, add a line to that file giving the relative path (relative to module) to the file , including the file name. For example, to delete...
WC_demo.ear/Stores.war/mystore/file.txt...put...
mystore/file.txt...in the file on a line by itself.
- Package the assets in a ZIP file
After you have collected all of the assets, we will have a directory that has a structure underneath it that should match the production EAR file. For example, you can have a structure similar to this:
/exportTemp/partialApp/
/exportTemp/partialApp/WebSphereCommerceServerExtensionsLogic.jar
/exportTemp/partialApp/Stores.war/myStore/index.jsp
/exportTemp/partialApp/Stores.war/WEB-INF/lib/myUtilities.jar
/exportTemp/partialApp/xml/messaging/user_template.xmlThe directory...
/exportTemp/partialApp/...represents the root of the production EAR file.
Use a ZIP utility to create a zip file of all of the files and directories under...
/exportTemp/partialApp/This ZIP file will then be used to update the WebSphere Commerce J2EE application.
Related tasks
Deploy J2EE assets for a partial application