Start of Content Area

Procedure documentation Using Ant Scripts to Work with SDAs  Locate the document in its SAP Library structure

Use

You need Ant scripts to automate repeated deployment-related tasks. To do so, you need to modify the available example_build.xml file to suit your needs.

More information: ant.apache.org.

Procedure

Making SDAs

Use the sapimportear task. It takes as a parameter a set of EARs specified by the standard Ant fileset task.

Example

<target name="import_ear">

   <sapimportear>

      <fileset dir="c:/temp">

         <include name="**/*.ear"/>

      </fileset>

   </sapimportear>  

</target>

The result is an SAP-compatible deployment archive for each input EAR. Results are located in the <Installation_Directory>/usr/sap/<SID>/<Instance_Number>/j2ee/deployment/SDA folder.

Deploying SDAs

Use the sapdeploy task. It can deploy a set of SDAs located in the fileset directory.

Deployment Strategies

      The Deploy all  option is most suitable when you deploy Java EE archives since they do not have meaningful versions.

      Deploy only files with the same or lower versions

      Deploy only files with lower versions

Example

<target name="deploy">

   <!-- versionrule: "all" | "same_and_lower" | "lower" -->

      <sapdeploy versionrule="all">

         . . .

      </sapdeploy>

</target>

Error strategies

        Stop - The whole deployment process will fail when one of the deployments fails. This is the default and recommended error behavior.

        Skip - If the deployment of one of the components fails, all depending components are skipped and not deployed. The process continues with the next component in the deployment queue that does not depend on the failed component. When calculating depending components, deploy time references described in the SAP_MANIFEST are taken into account.

Example

<target name="deploy">

   <!-- versionrule: "all" | "same_and_lower" | "lower" -->

      <sapdeploy versionrule="all">

         <!-- erroraction:   "prerequisites" | "deploy" | "undeploy" -->

         <!-- errorstrategy: "stop" | "skip" -->

         <saperrorhandling erroraction="prerequisites" errorstrategy="stop"/>

         <saperrorhandling erroraction="deploy" errorstrategy="stop"/>

      </sapdeploy>

</target>

Fileset

Specify the directory where the archives are.

Example

<target name="deploy">

   <!-- versionrule: "all" | "same_and_lower" | "lower" -->

      <sapdeploy versionrule="all">

         <!-- erroraction:   "prerequisites" | "deploy" | "undeploy" -->

         <!-- errorstrategy: "stop" | "skip" -->

         <saperrorhandling erroraction="prerequisites" errorstrategy="stop"/>

         <saperrorhandling erroraction="deploy" errorstrategy="stop"/>

         <!-- specify absolute path to the archives -->

         <fileset dir="c:/temp">

         </fileset>

      </sapdeploy>

</target>

Server

Used to specify the location of the server on which to deploy:

        Server host

        Server port

        User name

        User password

Example

<target name="deploy">

   <!-- versionrule: "all" | "same_and_lower" | "lower" -->

      <sapdeploy versionrule="all">

         <!-- erroraction:   "prerequisites" | "deploy" | "undeploy" -->

         <!-- errorstrategy: "stop" | "skip" -->

         <saperrorhandling erroraction="prerequisites" errorstrategy="stop"/>

         <saperrorhandling erroraction="deploy" errorstrategy="stop"/>

         <!-- specify absolute path to the archives -->

         <fileset dir="c:/temp">

         </fileset>       

         <sapj2eeengine

            serverhost="localhost"

            serverport="50004"

            username="Administrator"

            userpassword="qwe123"

         />

      </sapdeploy>

</target>

Undeploying SDAs

You can undeploy components specified in a list.

Undeployment Strategies

        If depending stop - If there are components that depend on the software component that has to be undeployed and these are not part of the list of components that have to be undeployed, the undeployment process will stop. The dependent components have to be undeployed for the undeployment to be successful.

        Undeploy Depending - All deployed components that depend on the component that has to be undeployed will be undeployed too.

Caution

Please use this strategy with caution. If there is a large dependency chain, you may undeploy applications you did not intend to undeploy.

Example

<target name="undeploy">

      <!-- undeploy strategy: "IfDependingStop" | "UndeployDepending" -->

            <sapundeploy undeploystrategy="IfDependingStop">

                  . . .

            </sapundeploy>

</target>

Error Strategies

You specify them with the saperrorhandling element.

        Stop when the first error occurs - The whole undeployment process will fail if one of the undeployments fails. This is the default error behavior.

        Skip undeployment of archives depending on the erroneous undeployment - This option is most suitable when undeploying Java EE archives since all your archives will be undeployed. If the undeployment of some of the components fails, all depending components are skipped and not undeployed. The process continues with the next component in the undeployment queue that does not depend on the failed component.

Example

<target name="undeploy">

   <!-- undeploy strategy: "IfDependingStop" | "UndeployDepending" -->

      <sapundeploy undeploystrategy="IfDependingStop">

      <!-- erroraction:   "prerequisites" | "deploy" | "undeploy" -->

         <!-- errorstrategy: "stop" | "skip" -->

         <saperrorhandling erroraction="prerequisites" errorstrategy="stop"/>

         <saperrorhandling erroraction="undeploy" errorstrategy="stop"/>

         . . .

      </sapundeploy>

</target>

List with Components for Undeployment

You have to list the components for undeployment in a plain text file. Components have to be listed as <vendor>/<name> pairs, each on separate line.

Example

isv.com/app1

isv.com/app2

Then the file is referred to as a attribute to the sapundeploylist element.

Example

<target name="undeploy">

   <!-- undeploy strategy: "IfDependingStop" | "UndeployDepending" -->

      <sapundeploy undeploystrategy="IfDependingStop">

      <!-- erroraction:   "prerequisites" | "deploy" | "undeploy" -->

         <!-- errorstrategy: "stop" | "skip" -->

         <saperrorhandling erroraction="prerequisites" errorstrategy="stop"/>

         <saperrorhandling erroraction="undeploy" errorstrategy="stop"/>

         <!-- specify absolute path to the file containing list with components for undeploy -->

         <sapundeploylist listfilepath="c:/temp/UndeployList.txt"/>

         . . .

      </sapundeploy>

</target>

Server

You have to specify the location of the server from which to undeploy. The information you have to enter is the same as the server for deployment.

Specifying Substitution Variables

You should use the task params.

Variables

The substitution variables should be listed in a plain text file with format: <name>=<value> on each line of the file.

The location of the file is specified as an attribute to the sapparamslist element.

Example

<target name="params">

   <!-- remove: "yes" | "no" -->

      <sapparams remove="no">      

         <!-- specify absolute path to the file with params list -->

         <sapparamslist listfilepath="c:/temp/ParamsList.txt"/>        

         . . .

      </sapparams>

</target>

Server

You have to specify the location of the server from which to undeploy. The information you have to enter is the same as the server for deployment.

 

 

End of Content Area