In non-Corda related modules you should be able to depend on your CorDapp module in the normal way, without using any of the special targets from the Gradle plugins.
Alternatively, split your shared code out into a normal Java module that both depend on.