2

I am developing a web application for Wildfly 9 using a quite standard stack (Java 8, JAX-RS, Hibernate etc).

Now I have to use a third-party library, which has various dependencies to libraries version of Log4j etc. Since I don't want to analyze if these dependencies are compatible with the libraries in the current web-app, I thought it would be a good idea to define a Module in Wildfly. Something like

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="foo.md">
    <resources>
        <resource-root path="foo-1.0.jar" />
        <resource-root path="log4j-1.2.12" />
        <resource-root path="concurrent-1.0.jar" />
         <!-- etc -->
    </resources>
</module>

Then I could include the module using jboss-deployment-structure.xml

<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
    <dependencies>
        <module name="foo.md" >
            <imports>
                <include path="foo" />
                <exclude path="bar" />
            </imports>

        </module>
    </dependencies>
</deployment>

This way, I could isolate the dependencies of the third-party library and don't have to analyze if they are compatible with my app without using (imo heavy-weight) approaches like OSGi which would require more changes to the app or waiting for Jigsaw.

Is this a valid approach?

user140547
  • 7,750
  • 3
  • 28
  • 80

0 Answers0