ear包和war包的文件组织结构及制作方法

1.war包:标准格式:index.jsp(可选)+ META-INF目录 + WEB-INF目录
    index.jsp可有可无。
    META-INF目录下包括一个MANIFEST.MF文件,此目录和文件在用jar工具打包时会自动生成。
    WEB-INF目录下包括classes目录,lib目录,web.xml文件,web.xml文件格式如下:
<?xml version="1.0" encoding="GB18030"?>
<web-app version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
war包方法:jar -cvf XX.war 所包含文件

2.ear包:标准格式:war包+ META-INF目录
META-INF目录下包括一个MANIFEST.MF,application.xml,ibm-application-bnd.xmi,ibm-application-ext.xmi,was.policy。
application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

   <application id="Application_ID">
      <display-name>AsiainfoBICASApplicationEAR</display-name>
      <description>This is the Asiainfo BICAS Application Server Application.</description>
      <module id="WebModule_1">
         <web>
            <web-uri>example.war</web-uri>
            <context-root>/abc</context-root>
         </web>
      </module>
   </application>

ibm-application-bnd.xmi:
<?xml version="1.0" encoding="UTF-8"?>
<applicationbnd:ApplicationBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:applicationbnd="applicationbnd.xmi" xmlns:common="common.xmi" xmlns:application="application.xmi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:id="Application_ID_Bnd">
<appName xsi:nil="true"/>
<application href="META-INF/application.xml#Application_ID"/>
</applicationbnd:ApplicationBinding>

ibm-application-ext.xmi:
<?xml version="1.0" encoding="UTF-8"?>
<applicationext:ApplicationExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:applicationext="applicationext.xmi" xmlns:application="application.xmi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:id="Application_ID_Ext" sharedSessionContext="false">
<application href="META-INF/application.xml#Application_ID"/>
</applicationext:ApplicationExtension>

was.policy:
// WebSphere Application Server Security Policy for the Default Application

// Required for Snoop Servlet's call to get User Name from getUserPrincipal()

打包方法:jar -cvf XX.ear XX.war META-INF

你可能感兴趣的:(ear包和war包的文件组织结构及制作方法)