Dynamically build buildmaximoear.xml

If there is any change needed to build maximo ear file for Industry Solution, a directory “product” need to be created under deployment directory. All changes which need to be applied to buildmaximoear.xml have to be specified in this product xml file. For each product a separate xml file is needed. A new class MaximoBuildEarTask is created in psdi\tools directory. Before running ant task this class is called from buildmaximoear.cmd file. MaximoBuildEarTask class checks if “product” directory is present in deployment directory or not. If “product” directory present, the class checks if any xml file is present in product directory. If “product” directory is not present or any xml file is not present in “product” directory, this class will not do any action. Else it will read all product xml files and will apply changes to Buildmaximoear.xml file. Before updating buildmaximoear.xml file, original copy of the file will be stored in deployment directory. This buildmaximoear-org.xml will never change once created. So it always contains the original content of the file from installation. A log file “buildmaximoear+timestamp.log” will be created in log directory.

Each product xml file need to specify changes in following format.

<product> - Name of the product

<targetadd> - If a new target node need to be added to buildmaximoear.xml file, it should be specified in targetadd tag. Targetadd tag has two sub tags. 
	<targetname> - Name of the new target node.
<content> - Entire text that need to be added as a new target node to buildmaximoeara.xml should be placed in content tag.

Check buildearproduct.xml to see an example.

<targetupdate> - If target already exist in buildmaximoear.xml and you want to update the target by adding new line or updating attribute, the text should be placed in targetupdate tag. Targetupdate tag has two sub tags. 
	<targetname> - Name of the existing target node.
<content> - All changes need to apply for the existing target should be in content tag. Content tag can have three types of sub tags.
<targetattribute> - This tag is used if any attribute of the target node need to be changed. This tag shouldn’t be used for any child node of the target.
<add> - This tag is used if a new node needs to be added to the existing target node. Add tag can contain multiple nodes to add to the target. Every node should start as a child of the target node. For example if add tag has a node 
<property name="maximo.mobilewarfile" value="mobileweb.war"/>
property tag will be added as an immediate child of target node. If you want to add a node which is not an immediate child of target node, you need to specify entire path to the child from the target node. For example 
<ear destfile="${maximo.deploydir}/${maximo.earfile}" 
				appxml="${maximo.appxmlfile}">
		
	<fileset dir="${maximo.basedir}">
		<exclude name="mobileweb/**/*.*"/>
	</fileset>

</ear>
In this case ear tag and fileset tags are already present in the target node. We need to add <exclude name="mobileweb/**/*.*"/>  as a child of fileset node. There may be already other children exist for fileset tag. We just need to add another child to fileset. To do this the entire path from the target node should be specified.

		<update> - This tag is used if an existing node of existing target need to be modified. The 			difference between add and update tag is, update tag doesn’t add a new node. It 				modifies existing node. It doesn’t replace the original node with the new value, it 				appends to it. For example

		<property name="maximo.maximouiwarclasspath" value="lib/soap.jar"/>

			Here there was already a property node with 									name="maximo.maximouiwarclasspath" and we want to add 							lib/soap.jar to the existing value. 

Check buildearproduct.xml to see an example.