If you are sharing classes between applications, then you'll want to isolate those into a separate module and introduce a dependency on that module within each app that uses the shared classes. There are two examples of this in our quickstart repository:
Packaging as an EAR:
Packaging as independent applications:
Keith Babo wrote:
If you are sharing classes between applications, then you'll want to isolate those into a separate module and introduce a dependency on that module within each app that uses the shared classes.
We are using independent applications in our system, so the only option to use SCA invocation between deployments is making an "interface + DTO" module (did you mean a "JBoss modules" module?) and installing it into jboss + attaching proper jboss-deployment-structure.xml to every deployment that needs to use the interface?
The point against it is that we need to restart jboss in case of interface updates.
Is it possible to use shared classes as a deployment?
Yes, you should definitely isolate classes shared between deployments in a separate JBoss Modules module. You can declare a dependency on this module via jboss-deployment-structure.xml or an entry in your manifest.
Updates to the shared interfaces module should be carefully considered in terms of lifecycle and compatibility with applications that depend on the shared module. You might want to experiment with using slots which would provide you a form of versioning and also isolate changes to a specific slot (applications change their dependency to the new slot when they can). Just brainstorming here.
All deployments are modules, so yes, you can use a deployed jar as a dependency. I'm pretty sure that changes (via redeploy) to the shared classes module will trigger a redeploy of dependent applications, so keep that in mind.
Yep, that's right, everything's right. I got the same things in mind after some brainstorming also. Especially the "slot" one is good.