-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document strategy for shading dependencies and merging indices #100
Comments
Hey visi. Some good points here. Although, I think the cleanest approach is that you just reindex the shaded jar. The overhead is about the same, if you merge we'd have to create a merge plugin tool, and that would throw away the existing indexes since names are radix trees. Further there might be other transformations that are done and this could mean an index might contain other data that is now invalidated by the shading process. If you just repeat the indexing phase everything is correct and accurate. |
Are there configurations like "ignore private methods" / "ignore certain packages"? If reindexing, then the configurations would have to be repeated for the reindex part :-/ |
For reasons stated above, I'm inclined to just reject this. The best approach is to reindex the shaded JAR -- especially considering that classes may be relocated during shading, so some level of duplicate configuration is necessary anyway. What the Maven plugin could and should do is offer a more streamlined configuration for this situation. Currently (in the |
What do you mean by "some level of duplicate"? Case a
Pros:
Cons:
Case b
Pros:
Cons:
|
I was solely thinking of a solution in the Jandex Maven plugin. It didn't occur to me that we could provide a resource transformer to be used by people that use the Maven Shade plugin. I'm looking at that API and I think it would be almost sufficient without having to actually merge indices. The resource transformer can be notified of any My plan here is to provide a new goal of the Jandex Maven plugin to index a JAR. That goal would take a path to the JAR, set of includes and excludes relative to the root of that JAR (similarly to the existing goal), and would add/replace a |
Done in #198. |
AFAIK the current "standard" is to include index as
META-INF/index.idx
.However, that would result in collisions when dependencies are shaded, so it looks like jandex is not ready for adding indices to Java libraries yet :(
I think it would be helpful if there was a documented procedure to merge indices (and remap classnames) for shading dependencies (e.g. Resource Transformers for
maven-shade-plugin
, Content Merging incom.github.johnrengelman.shadow
Gradle plugin, and so on).The text was updated successfully, but these errors were encountered: