-
1. Manifest locations for web archives
tommysdk Apr 16, 2011 3:39 PM (in response to tommysdk)Recap on the discussions on the JIRA issue.
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
System.out.println(war.toString(true));
... will give the following output:
test.war
/META-INF/
/META-INF/persistence.xml
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/