WAR/JAR/EAR中MANIFEST.MF的用途是什么? [英] What is use of MANIFEST.MF in WAR/JAR/EAR?

查看:234
本文介绍了WAR/JAR/EAR中MANIFEST.MF的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道移动应用程序中MANIFEST文件的用法,但不知道Java应用程序中MANIFEST文件的用法.

I am aware of usage of MANIFEST file in a mobile application, but am not aware of usage of same in a Java Application.

我的猜测是这样的,它仅用于保留BUILD信息.我正确吗?

My guess say like, its being used to keep BUILD information only. Am I correct??

这是强制性的吗?如果不是,那么我们可以从中获得哪些主要好处?

Is this Mandatory?If not, then what are the key benefits that we can draw with this?

推荐答案

manifest.mf带有工件的属性.例如,最著名的之一是jar的主类,当未指定其他类时,该主类用于启动jar文件.语法:

manifest.mf carries attributes of the artifact. One of the most well known ones is for example the main class of the jar that is used to start the jar file when no other class is specified. Syntax:

Main-Class: classname

其他用途例如是包装密封和包装版本控制.查看有关它的Java教程: http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html

Other purposes are, for example, package sealing and package versioning. Check out the java tutorial about it: http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html

罐子中的清单通常包含的信息要少于例如AndroidManifest.xml.它非常轻巧,不包含任何内部版本或包装信息.

A manifest in a jar usually contains much less information than for example AndroidManifest.xml. It is quite lightweight and does not contain any build or packaging information.

这是因为java没有好的模块系统.因此,jar不是一个可能需要大量配置信息的模块(例如它具有依赖关系的模块列表).相反,一个jar只是一堆带有一些配置信息的类.希望可以通过 project拼图( http://openjdk.java .net/projects/jigsaw/).

This is because java has no good module system. So, a jar is not a module which might need a lot of configuration information (like a list of modules to which it has dependencies). Instead, a jar is just a bunch of classes with some configuration information. Hopefully, this will be fixed by project jigsaw (http://openjdk.java.net/projects/jigsaw/).

这篇关于WAR/JAR/EAR中MANIFEST.MF的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆