I've a multimodule project that is mostly open source but has one module (a compiler) that is proprietary so its src/main/java folder needs to be removed before releasing. The proprietary modules builds an obfuscated jar which is used by other modules that need to invoke the compiler from the original jar to build everything else in the release. One of these is a mojo that is used to compile the rest of the system. So after removing proprietary sources, I need to wind up with a working mojo so users can compile the non-proprietary parts of the system using binary-only obfuscated compiler jars.
Call the proprietary module "compiler" and the obfuscated jar it produces "compiler.jar". I think I need another module, "compiler-bin", with "compiler.jar" as a dependency, that adds compiler.jar to the repository with the new name, "compiler-bin.jar", then change everything (mojo, etc) to depend on compiler-bin.jar instead of compiler.jar. Then distribute by cloning the whole tree, remove the compiler source module by hand, hand-tweak the poms to repair the breakage, and...; it gets to be a fair bit of work.
I'm hoping for something more automatic that derives a new copy of the original tree (with all sources) to produce a for-distribution tree (minus proprietary sources) that can be built without further hand-tweaking.