We have a Maven project that we are using to deploy several wars to a JBoss server. We recently noticed that one of the jars that a couple of our wars depend on, uses Xerial. When Xerial starts it tries to load up a native driver, but only the first one successfully loads the native driver and the rest fail and fall back on a pure Java implementation because the native driver is already in a classloader. We would really like to gain the performance back by being able to load the native driver on all the wars.
It looks to me like the best way to do this would be add the jar we depend on to the JBoss server as a module, and then have the services depend on it.
My question is, is there a way we can get our Maven build to do this? Or are we going about this in the completely wrong way?
I know this question has been marked as answered and the answer is that this currently is not possible, but I want to provide an alternative view. I am currently deploying Jboss modules to EAP 6.1 with Maven at my job. What we have done is use the maven-wagon plugin to scp the module to the tmp directory on the jboss server. I then use the maven-wagon plugin to issue a ssh command to the server to call the jboss-cli.sh script and tell it to perform a module installation. Here is a sample config:
First and most of all Apache Maven is a build management tool. It will "package" a project and will normally upload it to a repository so it can be used by other projects. However, there are plugins available, which can deploy to JBoss:
The first is JBoss specific, the latter a generic Java EE-container deploy plugin
After a few days of looking, and talking to a couple of people who were much more familiar with JBoss-Maven interaction than me, it turns out the answer to my question is that it cant currently be done. There is no Maven plugin capable of deploying a Module to JBoss. This is largely in part to the fact that the modules are only loaded by JBoss when it starts, although if anyone is feeling particularly ambitious and wants to write their own Maven plugin, it could theoretically be worked around.
The answer @Robert Scholte left is a good one, and I learned from it, however it didn't actually answer my question.
It´s not possible beause you have to use an OSGI approach. To use maven try to work with OSGI within EAP, but it depends what you looking for. OSGI is supported since JBoss EAP 6.1.
If you are trying to work with EAI try to work with JBoss Fuse instead of EAP. Then you will work with maven repositories, nexus or similar, hot deploy and all OSGI bundles stuff.
I'd suggest to put your jar in the lib folder of the jboss server. This way, the jar is loaded in the shared classpath when the server starts. This will definitively serve the purpose.
Here is the jboss folder structured expleained. http://docs.jboss.org/jbossas/guides/installguide/r1/en/html/dirs.html