Hi,
I'm trying to fix some Maven-weirdness in Ratis, and as a result have
found that Precommit is a broken from my "fixing" :). This is a little
complicated, so let me try to explain what's happening at a high level:
Ratis has a Maven module in which they compile from protobuf definitions
and then bundle relocated, third-party dependencies into a jar for the
rest of the Maven modules to use. They presently do this in four steps:
* Generate protobuf java source
* Use shade-plugin to create a source jar for the third party deps with
relocation.
* Unpack that shaded source-jar
* Recompile all of the code to create a single jar
This can obviously be simplified into the following, skipping that
unpacking step (halving the build time of that module):
* Compile protobufs and build jar
* Use shade-plugin to include relocated, third-party code into a jar
The fun part is that this change breaks Precommit because the maven
plugin is using the "test-compile" Maven lifecycle phase for the "unit",
"findbugs", and "compile" Yetus tests. It breaks precommit because the
shade-plugin doesn't run until the package lifecycle phase, and thus
downstream Maven modules from this one miss all of the third-party code
because the shaded jar wasn't built (the Maven reactor only finds the
compiled protobuf classes).
I think the long term solution is to pull out the shading of third-party
deps into its own jar and pull it out of the Ratis day-to-day build.
I am hoping to come up with a workaround for now. I could change the
shade-plugin to bind to the compilation phase instead of package but
that goes against the "maven way". I was hoping to find any way that
would let me override `maven_modules_worker`, shy of copying/modifying
the entire plugin. Any suggestions?
Thanks in advance!
- Josh