1 Reply Latest reply: Apr 16, 2011 3:39 PM by Tommy Tynjä RSS

    Manifest locations for web archives

    Tommy Tynjä Newbie

      Thread to further discuss the proposed solution for SHRINKWRAP-266, please see JIRA issue for previous discussions.


      Maybe it would be sufficent to only add a couple of more web container specific methods to add the capability of adding resources etc into WEB-INF/classes/, WEB-INF/classes/META-INF, WEB-INF/classes/META-INF/services etc.

        • 1. Manifest locations for web archives
          Tommy Tynjä Newbie

          Recap on the discussions on the JIRA issue.


          WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")

             .addAsManifestResource("test-persistence.xml", "persistence.xml");



          ... will give the following output:





          The question is how to handle web archive WEB-INF/ and WEB-INF/classes. E.g. Service provider registrations appear in /META-INF/services/ rather than in /WEB-INF/classes/META-INF/services/. There are many frameworks that requires that WEB-INF/classes/META-INF exists, e.g. persistence spec, JSF and service providers. Therefore it should be possible to add content to the /WEB-INF/classes/META-INF and /WEB-INF/classes/META-INF/services.


          My proposal after looking into this is:


          war.addAsManifestResource() -> /META-INF/ (keep as is)

          war.addAsWebManifestResource() -> /WEB-INF/classes/META-INF/

          war.addAsServiceProvider() -> /WEB-INF/classes/META-INF/services/ (instead of /META-INF/services)

          war.setManifest() -> /META-INF/MANIFEST.MF


          It would also make sense to provide a method that puts a MANIFEST.MF in WEB-INF/classes/META-INF/ just as the setManifest method:

          war.setWebManifest() --> /WEB-INF/classes/META-INF/