# Using the applyCM Utility

After an implementation team has completed CM development on a Windows server or prepared a fix in a development environment, they will need to copy and apply the CM modules to a packaging environment on the same platform as the target (production or testing, for example). In other words, if the target system is a Unix platform, the packaging environment must be on Unix as well.

The `applyCM.sh` utility (`applyCM.cmd` for Windows installations) serves this need. It can be used to copy and apply all CM development modules to a packaging environment or any specific extract (patch) of CM development. The script needs to be executed using the full pathname (this is necessary because you need to be located in a different folder, see below). In addition, you need to be set to a target environment (such as packaging environment).

Script: `<CM scripts>/applyCM.sh`

Usage:

`(no options)`

Apply the patch on top of the existing base product and possibly CM integration environment. This mode will add new CM files from the patch to the environment and replace the changed ones. But it will not delete the previously existing in the environment CM modules that are not part of the patch.

It needs to be executed from the source root folder.

`-d`

Remove all previous CM modules from the environment and apply patch on clean base product environment. This option is useful when needed to create the CM integration environment from scratch.

It needs to be executed from the source root folder.

`-b`

Recompile the existing sources in current environemnt. Usually it is used to execute full recompile a development environment.

It needs to be executed from the application folder root. For example: `$SPLEBASE`.

`-n`

It will not stop/start automatically the target environment.

The input for `applyCM.sh` utility is the current folder (source root folder), which contains the following subfolders:

- java
- scripts
- etc
- services
- splapp

These subdirectories contain only CM modules created according to the rules of the document "Naming conventions for tailoring application implemetation" (see the Installation Guide of the product). This directory structure should be prepared and filled with relevant CM modules on development Windows server, then copied over to the server that hosts a packaging environment by ftp utility. After that, you can apply the patch to the packaging environment. Modules that are not created using these conventions will be ignored by `applyCM.sh` utility. You have to reside in the patch directory to apply the patch. `ApplyCM` utility will generate and compile java code and create a java jar file (`cm.jar`), which is required for customer implementation platform.

Parent topic: App Server CM Packaging Tools