How to read MANIFEST.MF inside WAR application?

前端 未结 4 1516
执笔经年
执笔经年 2021-02-04 07:07

I would like to read MANIFEST.MF of my WAR application. How can I find its file name?

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 07:39

    I had the same problem in every application and decided to create a component with a utility class in it: jcabi-manifests. Now it's easy to load any attribute from one of available MANIFEST.MF in classpath:

    import com.jcabi.manifests.Manifests;
    String value = Manifests.read("My-Version");
    

    Also, check this out: http://www.yegor256.com/2014/07/03/how-to-read-manifest-mf.html

提交回复
热议问题