Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to generate SAP_MANIFEST.MF using Ant

Hi,

I am trying to migrate a J2EE application to SAP j2EE Engine from JBoss AS. We already have an extensive Ant build file that builds .war for Tomcat, .ear for JBoss etc. I would like to modify this build file so it can also build a .ear for SAP.

I have spent quitte some time browsing the forums and I saw some suggestions that there is an Ant task that I could use:

com.sap.sdm.ant.JarSAP

However, I cannot find this class in SDM.jar of SAP 6.40... Has this class been removed? Am I looking for it at the wrong place? Is there a better way to build an ear for SAP? I don't want to use the SAP build tools because we already have a working Ant script and we need to support multiple application servers, not just SAP.

Any help would be greatly appreciated (and rewarded with points :).

-Stijn

Related forum topics:

-


Creating SDA's (or other suitable archives) using ANT

Creating SDA (or other suitable archives) using ANT

Deployable DC's

deployable DC's

Building EAR-files with ANT

Building EAR-file with ant

Former Member
Former Member replied

I agree.

What I have done to generate the manifest files from an ant task, and simple use the zip task to make the ear file. But it is producing the files I need. So for me it's okay now.

Herewith I provide you (and all others who wnat to use ANT for EAR and Deploy) with my files. You can easily adapt them to your own needs.

BUILD.XML

[code]

<project name="BoonApp" default="build" basedir="d:\my projects\SAP\BoonApp">

<description>

Deploy BoonApp Application to SAP Web AS

</description>

<property name="deploy.base.dir"

location="c:\usr\sap\j2e\jc00\j2ee\deploying" />

<property name="deploy.lib.dir"

location="${deploy.base.dir}\lib" />

<property name="deploy.manager.config"

location="$\deploy-manager-config.xml" /> <property name="earfile" value="${ant.project.name}.ear" /> <property name="jardir" value="d:\my projects\SAP\Boon" /> <!-- ============================================= Build the EAR file ============================================= --> <target name="ear" depends="checkearuptodate" unless="ear.uptodate"> <tstamp> <format property="buildTime" pattern="yyyy.MM.dd.hh.mm.ss"/> </tstamp> <manifest file="META-INF\MANIFEST.MF"> <attribute name="Implementation-Title" value="${ant.project.name}"/> <attribute name="Specification-Vendor" value="SAP AG"/> <attribute name="Implementation-Vendor-Id" value="mycompany.com"/> <attribute name="Implementation-Version" value="$"/> </manifest> <manifest file="META-INF\SAP_MANIFEST.MF"> <attribute name="Ext-SDM-SDA-Comp-Version" value="1"/> <attribute name="softwaretype" value="J2EE"/> <attribute name="JarSAP-Version" value="20041217.1600"/> <attribute name="JarSAPProcessing-Version" value="20060104.1634"/> <attribute name="deployfile" value="sda-dd.xml"/> <attribute name="keyname" value="${ant.project.name}"/> <attribute name="keyvendor" value="mycompany.com"/> <attribute name="keylocation" value="localhost"/> <attribute name="keycounter" value="$"/> <attribute name="componentelement" value="&lt;componentelement name=&quot;${ant.project.name}&quot; vendor=&quot;sap.com&quot; componenttype=&quot;DC&quot; subsystem=&quot;NO_SUBSYS&quot; location=&quot;localhost&quot; counter=&quot;$&quot; deltaversion=&quot;F&quot; updateversion=&quot;LB-20060523162952&quot; componentprovider=&quot;localhost&quot;/&gt;"/> <attribute name="JarSL-Version" value="20060106.1831"/> <attribute name="compress" value="true"/> </manifest> <echo file="META-INF\sda-dd.xml" message="&lt;SDA&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;SoftwareType&gt;J2EE&lt;/SoftwareType&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;engine-deployment-descriptor version=&quot;2.0&quot;&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.dc_name&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.dc_vendor&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.sld.GatewayHost&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.sld.GatewayService&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/engine-deployment-descriptor&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/SDA&gt;" /> <zip destfile="$"> <fileset dir="$" includes="*/.jar" /> <fileset dir="$"

includes="META-INF/**"/>

</zip>

<delete file="META-INF\sda-dd.xml" />

<delete file="META-INF\MANIFEST.MF" />

<delete file="META-INF\SAP_MANIFEST.MF" />

</target>

<!--

=============================================

Deploy the EAR to the Web AS

=============================================

-->

<target name="build" depends="ear" unless="ear.uptodate">

<java dir="${deploy.base.dir}"

classname="com.sap.engine.offline.OfflineToolStart"

fork="yes">

<arg value="com.sap.engine.deploy.manager.DeployManagerImpl" />

<arg value=";.\lib"/>

<arg value="${deploy.manager.config}"/>

<classpath>

<pathelement location="${deploy.lib.dir}/launcher.jar"/>

</classpath>

</java>

</target>

<!--

=============================================

Check if the EAR file is up to date

=============================================

-->

<target name="checkearuptodate">

<condition property="ear.uptodate">

<and>

<uptodate targetfile="$"> <srcfiles dir="$" includes="*/.jar" /> </uptodate> <uptodate targetfile="$">

<srcfiles dir="META-INF"

includes="*" />

</uptodate>

</and>

</condition>

</target>

<!--

=============================================

Rebuild and deploy the BoonApp application

=============================================

-->

<target name="rebuild"

depends="clean, build">

</target>

<!--

=============================================

Clean the EAR file up to force a rebuild

=============================================

-->

<target name="clean">

<delete file="$" />

</target>

</project>

[/code]

And this is the contents of the deploy-manager xml file

[code]

<deploy-manager-config>

<version-id></version-id>

<project-dir></project-dir>

<deployable-object action-type="deploy">

<ear-file>

<ear-path>d:\my projects\SAP\boonapp\boonapp.ear</ear-path>

</ear-file>

</deployable-object>

<login-info>

<host>192.168.0.35</host>

<port>50004</port>

<transport-protocol>None</transport-protocol>

<user-name>Administrator</user-name>

<user-password>mylittlesecret</user-password>

</login-info>

<user-role-mapping>

<role-name>unknown role</role-name>

</user-role-mapping>

<library-info></library-info>

<supports>

<support>p4</support>

</supports>

<deployment-properties>

<property></property>

</deployment-properties>

<repl-var-properties></repl-var-properties>

<log-file>d:\my projects\SAP\boonapp\deployer_log.txt</log-file>

</deploy-manager-config>[/code]

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question