[jboss-jira] [JBoss JIRA] (AS7-3203) Document how to use jboss-deployment-structure.xml to add dependencies for all modules

Stuart Douglas (JIRA) jira-events at lists.jboss.org
Wed Jan 11 22:12:21 EST 2012


     [ https://issues.jboss.org/browse/AS7-3203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Douglas resolved AS7-3203.
---------------------------------

    Resolution: Done


Adding an exported dependency to the top level deployment to make it available to the whole deployment is actually already documented in the class loading guide.
                
> Document how to use jboss-deployment-structure.xml to add dependencies for all modules
> --------------------------------------------------------------------------------------
>
>                 Key: AS7-3203
>                 URL: https://issues.jboss.org/browse/AS7-3203
>             Project: Application Server 7
>          Issue Type: Enhancement
>          Components: Documentation
>    Affects Versions: 7.0.2.Final
>            Reporter: erik van altena
>            Assignee: Stuart Douglas
>            Priority: Minor
>
> I deploy an ear with an EJB and a WAR module. In both modules I want to use logging, so I want to add the org.slf4j module to their classpath.
> My first attempt to get this done was this simple jboss-deployment-structure.xml file which I placed in the META-INF folder of the EAR.
> <?xml version="1.0" encoding="UTF-8"?>
> <jboss-deployment-structure>  
>   <deployment>  
>     <dependencies>  
>         <module name="org.slf4j" />  
>     </dependencies>
>   </deployment>  
> </jboss-deployment-structure>
> This however, does not get the job done in the case of an EAR though; SLF4J is not on the classpath of either ear module. When I deploy this exact file in a web application that deploys as a war (in the WEB-INF folder), this does work. Of course that makes some sense as the war doesn't have sub-deployments.
> In stead, I have to do this:
> <?xml version="1.0" encoding="UTF-8"?>
> <jboss-deployment-structure>  
>   <deployment>  
>     <dependencies>  
>         <module name="org.slf4j" />  
>     </dependencies>
>   </deployment>  
>   <sub-deployment name="chipstkpov-ejb.jar">
>     <dependencies>  
>         <module name="org.slf4j" />  
>     </dependencies>
>   </sub-deployment>  
>   <sub-deployment name="chipstkpov-web.war">
>     <dependencies>  
>         <module name="org.slf4j" />  
>     </dependencies>
>   </sub-deployment>  
> </jboss-deployment-structure>
> Note that the <deployment> section is still needed, if I leave it out the dependency still does not end up on the classpath of the sub-deployments. With this exact setup the EAR deploys just fine.
> As I understand from my test results, you need to;
> - define the dependencies you want to expose to the classpath in the <modules> section
> - per sub-deployment you have to then explicitly add that dependency as well
> What I would expect and prefer is that the first example I gave would do exactly the same WITHOUT me having to explicitly name the sub-deployments of the ear in this file. That is duplicate maintenance as any change I make to the build structure (maven poms in my case) I will now have to duplicate in this file.
> Note that if I am correct in my findings, it would be very useful if this is documented in the jboss classloading documentation.
> https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list