The jboss-dependency.xml is probably the best approach to achieve this. Have you actually tried this, to see if it met your needs?
I'm still looking for docs on how to specify an EAR deployment unit as a dependency, the article on the wiki is very thin on details and there seems to be no official documentation on this descriptor yet.
If you have any working examples on how to specify an EAR in jboss-dependency.xml, I'd appreciate that (and probably numerous other future users).
I agree, haven't found much documentation. You could try what is suggested in here: http://java.dzone.com/articles/jboss-microcontainer-virtual-deployment-framework
Search for 'jboss-dependency.xml' in section "Hidden Gems", in the XML snippet the second style uses an alias:
Then in the text it says:
Item (2) looks a bit more confusing, since we're missing additional information. By default deployment names inside MC are 'ugly' URI names, which makes typing them by hand an error prone proposition.
So, in order to still be able to easily declare dependency on other deployments, we need an aliasing mechanism to avoid this 'ugly' URI names. Making this as simple as possible, simply drop plain txt file named aliases.txt into your deployment, where each line contains a new alias, thereby giving a deployment archive one or more simple names used to refer to it.
Its possible that the name of the archive could be used instead of an alias - might be worth trying both options.
Hope that helps.
OK, thanks for suggestion.
I've tried it and it works. I needed to figure out some things by myself, because of the vapourmentation. So here are some things I've learned:
- both jboss-dependency.xml and aliases.txt must be placed in respective archives' META-INF subdirectory
- there are still some exceptions logged during application server startup because initially JAR's are deployed according to the standard order (JARs first, then EAR) and container complains "Deployment "blahblah.jar/" is missing the following dependencies: .... NOT FOUND Depends on 'MyApplicationAlias'".
However, once the EAR is deployed and its alias identified, immediately after EAR deployment completes JBoss notices that the dependency can now be satisfied and retries deployment of JARs - this time with success.
The aliases.txt file's location is: JBOSS_CONFIGURATION_DIR/farm/my-application.ear!META-INF/aliases.txt and the contents looks like this:
The jboss-dependency.xml file's location is: JBOSS_CONFIGURATION_DIR/farm/my-bpel-process.jar!META-INF/jboss-dependency.xml and the contents look like this:<dependency xmlns="urn:jboss:dependency:1.0"><item whenRequired="Real" dependentState="Create">WdxIntegration</item><item>WDX integration EAR dependency. The EAR must have the alias name "WdxIntegration" specifiedin its aliases.txt file.</item></dependency>
<dependency xmlns="urn:jboss:dependency:1.0"> <item whenRequired="Real" dependentState="Create">MyApplicationAlias</item> <item>My application EAR dependency. The EAR must have the alias name "MyApplicationAlias" specified in its aliases.txt file.</item> </dependency>