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
Avoid adding index file to the resources by default #4
Comments
Funny you mention this, the first releases placed the index file at a different location however changes were made to align this plugin with its Maven counterpart. You can change the location of the generated index file by setting the |
I doubt the index would be usable for a library in case the filename is customized, so I'm inclined to avoid including it at all. |
Hmm I guess I'm missing something here. The plugin does give you options to change either the name of the index, its location, or both. It's up to you as library author to decide which conventions to follow. This being said, if the location is changed to a different path then you'd still need additional configuration in the build file if the index has to be included in a JAR at some point. Thus, if the conventions are followed you don't need extra configuration, but if you do deviate from the conventions then you require additional configuration. A consumer that decides to shade resources would have to follow their own conventions, deal with potentially colliding entries. It's not the job of the index producer to solve this particular problem. |
I see. I thought it would be included into the jar under a customized name.
In practice, collision resolution is not very well implemented. Note: jandex misses the ability to merge indices, so consumers won't have an option to merge indices when they shade dependencies. That is why I would refrain from adding a fixed-named file to a library (e.g. https://github.com/pgjdbc/pgjdbc/ ). Note: I do not need the index for my library yet. I have no use case for it. I want to pass the classes through jandex to ensure that the resulting bytecode is parseable by jandex. Unfortunately, jandex has issues, and it results in Hibernate failing in surprising ways even though pgjdbc's bytecode is perfectly valid. This PR fixes classes that Jandex can't parse, and the only thing I want for now is a CI check that would ensure jandex compatibility. Of course, I would love jandex bugs to be fixed, however, it would take time for everybody to upgrade. |
re: License file. Precisely. You don't see plugin/library authors trying to fix this particular file name, do you? Because the "problem" is on the consumer side that requires shading, not on the producing side. I understand that Jandex has some short comings and the fixes may take some time to appear. Merging jandex index files could be done by Jandex itself or as an external shade/shadow transformer (like the This plugin lets you configure index name, location, and sources as needed. If the conventions are followed then there's little to no extra configuration needed. If a different convention is needed then extra configuration is mandated. I don't see what else needs to be updated/modified here, unless perhaps we enter a discussion on how much extra configuration may be required from a consumer's POV. |
I do. The standard location for the licence file is For example, junit4 renamed the file to LICENSE-junit.txt :( (however, they should have better be using the standard
I've filed the corresponding issue: smallrye/jandex#100
It would help if the documentation clarified when the index is automatically added to the jar, and when it is not. |
This validates my point regarding a resource transformer that targets Jandex index files until the time comes (if it comes) when Jandex offers an index merge option.
The readme shows the default value of the |
It does not look like "adds index to the jar" or "does not add index to the jar" to me :-/ Just in case, I just tried 0.8.0, and it looks like a customized destination does not make a difference. jandex-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/jandex/JandexPlugin.groovy Line 74 in 2964500
|
Just in case, the sequence of the tasks for
|
Indeed. The |
The plugin adds index file unconditionally, however, that would result in issues when dependency shading is used.
For instance, if different libraries add their own indices, then dependency shading would overwrite/duplicate index files.
I guess it would be nice to avoid adding the index file to the resulting jar file.
The
jandex
task would still be useful as it ensures the bytecode is jandex-parseable.The text was updated successfully, but these errors were encountered: