SiCN
SiCN

Reputation: 1082

Having a jboss-deployment-structure.xml with dependencies in common libraries

I have a small issue that is annoying me somewhat. We have built numerous commons libraries for all our applications deployed on JBoss/Wildfly. Some of those common libraries have dependencies to JBoss modules.

The common way for EAR and WAR files is to add a jboss-deployment-structure.xml to the archive, which contains a bunch of module-dependencies.

I have tried several times to add a jboss-deployment-structure.xml to my Commons JARs so that the WAR/EAR-archives that import them will automatically see the dependencies the JAR has as it's own, however, no attempt of doing this renders the correct result.

Has anyone successfully managed to declare "transitive" dependencies in JAR-files packed inside of WAR-files without having to redeclare the same dependencies in the WAR-file's jboss-deployment-structure.xml?

Any examples would be greatly appreciated!

Upvotes: 1

Views: 2280

Answers (1)

ozoli
ozoli

Reputation: 1424

You can use the MANIFEST.MF to declare dependencies for a JAR. The line will look something like:

Dependencies: org.some.module, org.another.module

The Maven plugin maven-jar-plugin will add it for you as part of the build process.

Your best option is to create your own JBoss module to hold all your common JARs used by all your different applications. This module would have it's own module.xml file declaring the dependencies on the JARs contained within it and one any libraries on other JBoss modules. These custom modules can also be versioned and applications can also depend on specific versions.

Upvotes: 2

Related Questions