To make this work w/o ugly hacks you simply need double configuration.
Where in one of them you actually have a mock mod_cluster supply.
Otherwise this is pretty much hackish to achieve,
as you still heavily depend on deployment order.
jbossweb is deployed first, at that time mod_cluster is not present in any state,
hence optional dependency is satisfied and afterwards never re-invoked.
But if the order was different you would wire up that optional dependency.
To make this "work" you would have to hack around the cleanup code
in order not to leave something hanging at the end and get incomplete deployment error.
With some mock object you always have proper order,
where in the mock case all you do is tag some bean as mod_cluster supplier.
We have an optional inject, but this is/should mostly be used when you know
you have a phase split - trying to optionally inject something from deployers/ into deploy/ beans.