1

i'm working with spring and i want to know when to use war / jar or ear. i've heard that ear contained both war and jar structures together but am not sure. i don't see the diffrence between jar and war especially that i'm working over the backend of a mobile application.

Can anyone explain the diffrence to me, i've worked with jar packaging but not with war or ear

ELLA
  • 11
  • 4

1 Answers1

1

speaking for web applications and microservices only

jar will normally be used with spring boot to produce a fat jar file which contains your application and an embedded server. In that case you receive a single jar file which when executed launches a server and that server hosts your application that you have developed. So 1 server 1 web application.

war and ear will normally be used when you already have a running server that hosts your applications. Then you can deploy on that existing server multiple war or ears as web applications and all of them will be hosted on the same server. Each file is smaller as it does not contain an embedded server. So 1 server multiple web applications.

You will now ask when is war used and when ear is used? It's already answered here

answer 1

answer2

answer 3

Panagiotis Bougioukos
  • 15,955
  • 2
  • 30
  • 47