role of META-INF directory

Teifi picture Teifi · Jun 24, 2013 · Viewed 14.8k times · Source

current spring-mvc webapp (also saw it in another primefaces webapp) webapplication directory structure:

webapp
|
|_src
|
|_WebContent
  |
  |__WEB-INF
  |
  |__META-INF
     |
     |__MANIFEST.MF

Always saw and MANIFEST.MF file in META-INF directory. Some times, it seems nothing else would happen if I deleted them. what's the role of them?

~#:cat MANIFEST.MF

Manifest-Version: 1.0
Class-Path:

Answer

PoeHaH picture PoeHaH · Jun 24, 2013

For web, the META-INF directory is typically found in Java based webapplications such as jsp (Java server pages). You can also find them in Java related webservers such as Apache-Tomcat.

The file you mentioned:

MANIFEST.MF: The manifest file that is used to define extension and package related data. So mostly it can contain human readable info like version, producer,.. but also machine readable info like module dependencies in external frameworks you may be using

Everything inside META-INF:

The files/directories in the META-INF directory are recognized and interpreted by the Java Platform to configure applications, extensions, class loaders and services.

When you don't "deviate" of the normal path (eg: you have no additional frameworks,...), you don't need certain files and thus nothing happens if you delete them. Java will create a default manifest file with every application.