[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-266) Manifest container for WebArchive should be WEB-INF/classes/META-INF

Dan Allen (JIRA) jira-events at lists.jboss.org
Wed Mar 30 00:30:38 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592577#comment-12592577 ] 

Dan Allen commented on SHRINKWRAP-266:
--------------------------------------

I see that in SHRINKWRAP-241 there was a discussion about where to put META-INF in a web archive. While it's true that there is still a manifest location in a web archive, it's a lesser used location. Plus, as I mentioned, mapping the manifest container to /META-INF breaks the addAsServiceProvider() feature, because extensions will not be picked up from /META-INF/services.

Thus, we need something else that maps to /META-INF in a WebArchive. Perhaps something like:

addAsWebManifestResource() maps to /META-INF

I know it's not as pretty, but really it's totally broken if we keep it as it is.

Case in point. I want to add a CDI extension to my web archive:

{code:java}
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
   .addClass(MyExtension.class)
   .addAsServiceProvider(Extension.class, MyExtension.class);
{code}

Current output:

{code}
test.war
/META-INF/
/META-INF/services/
/META-INF/services/javax.enterprise.inject.spi.Extension
{code}

Correct output:

{code}
test.war
/WEB-INF/
/WEB-INF/classes/
/WEB-INF/classes/META-INF/
/WEB-INF/classes/META-INF/services/
/WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension
{code}

> Manifest container for WebArchive should be WEB-INF/classes/META-INF
> --------------------------------------------------------------------
>
>                 Key: SHRINKWRAP-266
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-266
>             Project: ShrinkWrap
>          Issue Type: Bug
>          Components: impl-base
>    Affects Versions: 1.0.0-alpha-12
>            Reporter: Dan Allen
>
> This issue is a regression of SHRINKWRAP-186. The location of the ManifestContainer for a WebArchive should be /WEB-INF/classes/META-INF, not /META-INF. This location is backed up by our target locations per archive type page.
> http://community.jboss.org/wiki/Containerrootsperspecarchive
> A sample use case is bundling a persistence.xml in a web archive:
> {code:java}
> WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
>    .addAsManifestResource("test-persistence.xml", "persistence.xml");
> System.out.println(war.toString(true));
> {code}
> Current output:
> {code}
> test.war
> /META-INF/
> /META-INF/persistence.xml
> {code}
> Expected output:
> {code}
> test.war
> /WEB-INF/
> /WEB-INF/classes/
> /WEB-INF/classes/persistence.xml
> {code}
> This also breaks the ServiceLoader registrations, as they appear in /META-INF/services/ rather than in /WEB-INF/classes/META-INF/services/

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list