5.3 In was within the agency applied
Generally we use the ear format to weblogic our Web application in was, so Tomcat is slightly different here from the one in the.
To do this, we made an ant script to package our ear.
The format of an ear file should be as follows:
Myear
|__ Meta-inf
|__application.xml
|__mywar.war
As you can see, an ear file:
Contains a meta-inf directory in which there will be a application.xml file.
Then there will be a. war file in the same place as the Meta-inf directory, which is the Web application of the standard war format.
5.3.1 Application.xml File
<?xml version= "1.0" encoding= "UTF-8"?>
<application xmlns= "Http://java.sun.com/xml/ns/javaee"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" version= "5"
xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" >
<display-name>cbbsEAR</display-name>
<module>
<web>
<web-uri>cbbs.war</web-uri>
<context-root>/cbbs</context-root>
</web>
</module>
</application>
5.3.2 using ant Packaging
In fact, our ant script is simple, and it does the following things:
1 compile our project with IBM's own JDK, the IBM JDK, to ensure that our project can be resolved by our being.
2. Make our project A. War file
<target name= "Makewar" depends= "compile" >
<jar destfile= "${build.dir}/app/${war.name}" basedir= "${build.dir}"/>
</target>
3 Make the. war file and the Application.xml file into an. ear file
<target name= "Makeear" depends= "Makewar" >
<ear destfile= "${build.dir}/${ear.name}" appxml= "${eardescription.file}" >
<fileset dir= "${build.dir}/app" >
<include name= "**/*.war"/>
</fileset>
</ear>
</target>