Shade with SBT II

2016-11-12Home

Previously, we talked about how we shaded Gearpump dependencies with SBT. One thing I didn't see or mention at that time is that the compilation of depending projects could fail since the shading of depended libraries happen simultaneously. I tried enforcing shade first with tricks like SBT's sequential task but that didn't work (At least, I don't know how to). Finally, I went to Stackoverflow for last resort and Yuval Itzchakov saved my day with his answer that I should shade the depending project along with its dependencies.

Remember the shaded libraries were depended as unmanagedJars and we had to manually add the dependencies to the published pom of the depending project. Now the problem is kind of the opposite. The dependencies are already assembled and published as a uber jar with the depending codes. Now that being managed dependencies they also end up in the published pom. Hence, we need to manually remove the dependencies in pomPostProcess.

One more subtlety here is gearpump-streaming depends on gearpump-core with both test and provided dependencies. The published pom, however, only contains the test dependency. I haven't found a cleaner way than again manually added it. I also posted a question to Stackoverflow.

One one more thing is java.lang.VerifyError exceptions are thrown by JVM after the change. The work-around is adding -noverify in the JVM options. I haven't yet found the root cause and the issue is logged at GEARPUMP-236.

I have a feeling that there will be a third episode of our story with sbt shade.