Java 管理有关战争的修补程序信息

Java 管理有关战争的修补程序信息,java,jakarta-ee,manifest,war,Java,Jakarta Ee,Manifest,War,管理j2ee WAR文件上的修补程序版本信息的最佳/正确方法是什么 我想在WAR文件上维护补丁信息,以便在应用程序运行后,出于维护目的,这些信息可以显示在应用程序内部。 正在考虑几种可能的方法: 使用DB table–(我希望避免这种方法) 缺点 将WAR版本耦合到DB 修补程序增加了数据库脚本的额外开销 将内部XML文件添加到资源中,然后读取和分析/解析它 缺点 访问XML的问题(物理路径问题?) 将修补程序信息添加到MANFIEST文件 缺点 无法在应用程序中显示它

管理j2ee WAR文件上的修补程序版本信息的最佳/正确方法是什么
我想在WAR文件上维护补丁信息,以便在应用程序运行后,出于维护目的,这些信息可以显示在应用程序内部。
正在考虑几种可能的方法:

  • 使用DB table–(我希望避免这种方法)
    • 缺点
      • 将WAR版本耦合到DB
      • 修补程序增加了数据库脚本的额外开销
  • 将内部XML文件添加到资源中,然后读取和分析/解析它
    • 缺点
      • 访问XML的问题(物理路径问题?)
  • 将修补程序信息添加到MANFIEST文件
    • 缺点
      • 无法在应用程序中显示它
  • 我想知道是否有更多的方法,什么是最好的一个这样的要求。

    谢谢

    对于manifest.mf,必须使用包含以下条目的每个生成重新生成此文件:

    Implementation-Title: The value is a string that defines the title of the extension implementation.
    Implementation-Version: The value is a string that defines the version of the extension implementation.
    Implementation-Vendor: The value is a string that defines the organization that maintains the extension implementation.
    Implementation-Vendor-Id: The value is a string id that uniquely defines the organization that maintains the  extension implementation.
    Implementation-URL: This attribute defines the URL from which the extension implementation can be downloaded from.
    Specification-Title: The value is a string that defines the title of the extension specification.
    Specification-Version: The value is a string that defines the version of the extension specification.
    Specification-Vendor: The value is a string that defines the organization that maintains the extension specification.
    

    下面是关于如何使用manifest.mf从servlet读取它的讨论,必须使用包含以下条目的每个构建重新生成此文件:

    Implementation-Title: The value is a string that defines the title of the extension implementation.
    Implementation-Version: The value is a string that defines the version of the extension implementation.
    Implementation-Vendor: The value is a string that defines the organization that maintains the extension implementation.
    Implementation-Vendor-Id: The value is a string id that uniquely defines the organization that maintains the  extension implementation.
    Implementation-URL: This attribute defines the URL from which the extension implementation can be downloaded from.
    Specification-Title: The value is a string that defines the title of the extension specification.
    Specification-Version: The value is a string that defines the version of the extension specification.
    Specification-Vendor: The value is a string that defines the organization that maintains the extension specification.
    

    下面是关于如何从servlet读取它的讨论。不要为此使用清单。创建您自己的changelog文件格式,将其捆绑到WAR文件中应用程序已知的位置,并在应用程序中创建一个功能来显示此文件。清单不是为存储变更日志而设计的,从长远来看,这样做只会给您带来问题。我建议您添加一个属性,告诉您该版本的变更日志位于何处。例如:

    --- MANIFEST ----
    Application-Version: 1.2.5
    My-App-Changelog: /WEB-INF/changelogs/version-1.2.5.xml
    -----------------
    
    根据您使用的应用程序服务器或web容器,您可能能够创建一个扩展或另一个app=来内省所有已部署的WAR并显示此信息。您需要使用特定于供应商的API


    每次发布新版本时,该存档将包含所有版本的版本号和更改日志,这有助于快速跟踪更改。

    不要为此使用清单。创建您自己的changelog文件格式,将其捆绑到WAR文件中应用程序已知的位置,并在应用程序中创建一个功能来显示此文件。清单不是为存储变更日志而设计的,从长远来看,这样做只会给您带来问题。我建议您添加一个属性,告诉您该版本的变更日志位于何处。例如:

    --- MANIFEST ----
    Application-Version: 1.2.5
    My-App-Changelog: /WEB-INF/changelogs/version-1.2.5.xml
    -----------------
    
    根据您使用的应用程序服务器或web容器,您可能能够创建一个扩展或另一个app=来内省所有已部署的WAR并显示此信息。您需要使用特定于供应商的API


    每次发布新版本时,该存档将包含所有版本的版本号和更改日志,这有助于快速跟踪更改。

    考虑到您的问题,您可以通过多种方式存储版本:

    1.DB表 2.属性文件:最佳选择! 3. 获胜者:属性代码示例,在不到15分钟内进行测试。 在应用程序中,当您想要检索应用程序的版本时,只需执行以下操作:

    property.getProperty("APP-VERSION");
    

    考虑到您的问题,您可以通过多种方式存储您的版本:

    1.DB表 2.属性文件:最佳选择! 3. 获胜者:属性代码示例,在不到15分钟内进行测试。 在应用程序中,当您想要检索应用程序的版本时,只需执行以下操作:

    property.getProperty("APP-VERSION");
    

    是否要使用maven?更新版本的过程将手动完成。(分解战争并更新文件)关于1,查看SQLite并将文件嵌入战争。它本质上是2,有一些更像DB的东西。你可以通过这样做来避免路径问题。我会选择第二个选项。打开存储在classes目录中的XML文件很方便。修补web应用程序不是一个好的做法,因为它很少可重复。您最好使用新版本构建和发布一个完整的新WAR文件。是否要使用maven?更新版本的过程将手动完成。(分解战争并更新文件)关于1,查看SQLite并将文件嵌入战争。它本质上是2,有一些更像DB的东西。你可以通过这样做来避免路径问题。我会选择第二个选项。打开存储在classes目录中的XML文件很方便。修补web应用程序不是一个好的做法,因为它很少可重复。您最好使用新版本构建和发布一个完整的新WAR文件。用户需要的是变更日志,而不仅仅是版本。对于这个版本,他可以使用清单文件。看我的回答你是对的,我们可以这样做。这只是架构/设计理念的问题。用户想要的是变更日志,而不仅仅是版本。对于这个版本,他可以使用清单文件。看我的回答你是对的,我们可以这样做。这只是一个建筑/设计哲学的问题。
    property.getProperty("APP-VERSION");