![]() |
OpenMake Meister |
Manage and Update Deployment Descriptor Build Services are available to address the critical issue of handling J2EE application assembly and deployment to different server environments. These Build Services support a process that allows the unique configuration of .ears and .wars to be deployed to multiple production machines that have unique configurations.
When using the Deployment Descriptor Build Services you have the option of creating multiple .ear or .war files with different names containing different deployment descriptor information, or simply updating a single .war or .ear with new Deployment Descriptor information. If you require that your .war or .ear files be deployed to several machines, you may want to run a single build which creates multiple .war or .ear files with unique deployment descriptor information. For this purpose follow Table PB-7 to create multiple unique .war or .ear files.
Alternatively, you may need to only update a single .war or .ear with new Deployment Descriptor information. Using this method allows you to keep the name of your .war or .ear file with the same name. Follow Table PB-7 to update your .war or .ear with new Deployment Descriptor information.
The program xmltask from https://www.oopsconsultancy.com is utilized to update and insert XML nodes and values into a descriptor file. xmltask uses XPath for finding the appropriate XML node for updates and inserts. Documentation on the xmltask Ant task is available at https://www.oopsconsultancy.com/software/xmltask/index.html
Table PB-7 Creating Multiple Deployment Descriptor Targets
Step |
Action |
|
Note: You will need to create a Target for your original .war or .ear that does not contain a deployment descriptor as part of this process . |
1 |
Go to the Target Explorer tab found under the OM Meister Perspective. |
2 |
Right Click in the left pane of the Target Explorer and Select New – Target to launch the Target Wizard. |
3 |
Select the Java Operating System and the Manage Ear Deployment Descriptors or Manage War Deployment Descriptors. Select Next. |
4 |
Enter the Name of your Target. It is recommended to use a name that is specific to the machine location that the .ear or .war will be deployed. Select Finish. Example: .ear dependency - AutoWorld20Example.ear Target Name – Mach1_AutoWorld20Example.ear Mach1/AutoWorld20Example.ear
|
5 |
You will now be brought to the Target Overview Screen. Enter the Project which the Target is to be associated. |
6 |
Select the Detail tab at the bottom of your screen to enter your Target's file dependencies. |
3 |
Select the XML Update from the Target Definition Hierarchy. Click the Add Dep button to enter your Dependencies. The file dependency for the XML Update will be your original .ear or .war file. |
4 |
There are two options for updating the deployment descriptor XML, one using XML Insert and the other using XML Replace. If you simply need to insert data into your Deployment Descriptor file (i.e., .xml, .xmi, .template), the XML Insert is recommend. Alternatively, the XML Replace will let you replace existing data into your Deployment Descriptor file.
XML Insert Select the XML Insert Option Group from the Target Definition Hierarchy. Click the Add Dep button and enter your deployment descriptor file that is in .xml, .xmi, or .template format. This file must contain the XML nodes and values to be inserted into Deployment Descriptor. Once added, select your Deployment Descriptor File and edit the Standard Options. Enter the values for the following options. dest=<destination file name in the archive> path=<Xpath Insert String>
Example: dest=”WEB-INF/web.xml” path=”/application/servlet[last()]”
XML Replace Select the XML Replace Option Group from the Target Definition Hierarchy. Click the Add Dep button and enter your deployment descriptor file that is in .xml, .xmi, or .template format. This file must contain the XML nodes and values to be inserted into Deployment Descriptor.
Once added, select your Deployment Descriptor File and edit the Standard Options. Enter the values for the following options.
dest=<destination file name in the archive> path=<Xpath Search String> withText=<Replacement Text>
Example: dest=”WEB-INF/web.xml” path=”/application/server-name/text()” withText=”qa-server1” |
In the above example using XML Insert the contents of the first occurrence
WEB-INF/status-servlet.xml in the Dependency Directories will be inserted into WEB-INF/web.xml at the end of the <application>…<serlvets> nodes. The resulting output of the insert will be placed into the WEB-INF/web.xml file in the Target, ie. .war, .ear file.
In the above example using XML Replace, the first occurrence WEB-INF/web.xml.template in the Dependency Directories will be used as the template in which the <application>…<server-name> value will be set to qa-server1. The resulting output of the replace will be place into the WEB-INF/web.xml file in the Target, ie. .war, .ear file.
Example:
.ear dependency - AutoWorld20Example.ear
Target Name - qa_AutoWorld20Example.ear
qa/AutoWorld20Example.ear
This naming convention allows for multiple archives to be built at once from the same original source archive.
Table PB-8 Updating Deployment Descriptor Target
Step |
Action |
|
Note: You will need to create a Target for your original .war or .ear that contains no deployment descriptor as part of this process . |
1 |
Go to the Target Explorer tab found under the OM Meister Perspective. |
2 |
Right Click in the left pane of the Target Explorer and Select New – Target to launch the Target Wizard. |
3 |
Select the Java Operating System and the Updating Deployment Descriptors. Select Next. |
4 |
Enter the Name of your Target with an extension of .update. Select Finish. Example: .ear dependency – AutoWorld20Example.ear Target Name – AutoWorld20Example.ear.updated
This naming convention allows for the .ear or .war to be updated directly. The Target (.updated) will contain the log output and is a place holder for the date/time dependency checking.
|
5 |
You will now be brought to the Target Overview Screen. Enter the Project to which the Target is associated. |
6 |
Select the Detail tab at the bottom of your screen to enter your Target's file dependencies. |
3 |
Select the XML Update from the Target Definition Hierarchy. Click the Add Dep button to enter your Dependencies. The file dependency for the XML Update will be your original .ear or .war file. |
4 |
There are two options for updating the deployment descriptor XML, one using XML Insert and the other using XML Replace. If you simply need to insert data into your Deployment Descriptor file (i.e., .xml, .xmi, .template), the XML Insert is recommend. Alternatively, the XML Replace will let you replace existing data into your Deployment Descriptor file.
XML Insert Select the XML Insert Option Group from the Target Definition Hierarchy. Click the Add Dep button and enter your deployment descriptor file that is in .xml, .xmi, or .template format. This file must contain the XML nodes and values to be inserted into Deployment Descriptor. Once added, select your Deployment Descriptor File and edit the Standard Options. Enter the values for the following options. dest=<destination file name in the archive> path=<Xpath Insert String>
Example: dest=”WEB-INF/web.xml” path=”/application/servlet[last()]”
XML Replace Select the XML Replace Option Group from the Target Definition Hierarchy. Click the Add Dep button and enter your deployment descriptor file that is in .xml, .xmi, or .template format. This file must contain the XML nodes and values to be inserted into Deployment Descriptor.
Once added, select your Deployment Descriptor File and edit the Standard Options. Enter the values for the following options.
dest=<destination file name in the archive> path=<Xpath Search String> withText=<Replacement Text>
Example: dest=”WEB-INF/web.xml” path=”/application/server-name/text()” withText=”qa-server1” |