how to create ear file, and include war and jar files inside that

后端 未结 6 1406
小蘑菇
小蘑菇 2021-02-05 08:17

I am trying to create an EAR file from the command prompt. I have used

jar -cvf myServletWAR.ear . 

But my question is, how can I get this EAR

6条回答
  •  后悔当初
    2021-02-05 09:00

    If you have generated a client and EJB together, they are automatically packaged into an enterprise archive file (.ear) and you do not need to do this. Otherwise:

    • Package the EJB's .jar file into an .ear for your application. To do this use a jar command similar to the following:
    jar -cvf myApplication .ear myService.jar
    

    If you have a client .war file you can add that to the .ear file in the same way.

    • Create a deployment descriptor application.xml either using your
      application server's tools or by copying and editing a sample, as
      follows:

    • Locate a sample .ear, which is in examples directory in

    mapdemo/mapdemo/repos/myService.deploy/JMapServ-WL.ear
    
    • Extract the descriptor application.xml from the .ear file, using the following jar command:

    jar -xvf JMapServ-WL.ear META-INF/application.xml

    • Make a copy of the application.xml descriptor and edit it, replacing JMapServ with the name of your .jar file. You can also add the name of your .war file if you added that to the .ear file.

    • Put the descriptor in the meta-inf subdirectory of the directory containing your .ear file.

    • Package the descriptor into your .ear file using a jar command similar to:

    jar -uvf myService.ear META-INF/application.xml
    

提交回复
热议问题